home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual Foxpro 6.0 (Ent. Edition) / Vf6ent Extractor.EXE / TOOLS / CONVERT / TRANSPRT.PRG < prev   
Encoding:
Text File  |  1998-05-26  |  385.5 KB  |  12,293 lines

  1. *:*****************************************************************************
  2. *:
  3. *: Procedure file: TRANSPRT.PRG
  4. *:         System: FoxPro 2.6 Transporter
  5. *:         Author: Microsoft Corp.
  6. *:*****************************************************************************
  7. *
  8. * TRANSPORT - FoxPro screen, report and label conversion utility.
  9. *
  10. *:*****************************************************************************
  11. * Copyright (c) 1993-95 Microsoft Corp.
  12. * One Microsoft Way
  13. * Redmond, WA 98052
  14. *
  15. * Notes:
  16. * In this program, for clarity/readability reasons, we use variable
  17. * names that are longer than 10 characters.  Note, however, that only
  18. * the first 10 characters are significant.
  19. *
  20. *
  21. * Revision History:
  22. * First written by Matt Pohle, John Beaver and Walt Kennamer for FoxPro 2.5
  23. *
  24.  
  25. #INCLUDE transprt.h
  26.  
  27. PROCEDURE transprt
  28. PARAMETER m.g_scrndbf, m.tp_filetype, m.dummy, m.gAShowMe, m.gOTherm, m.cRealName, m.lPJX
  29. *-
  30. *- NOTE: gOTherm is a global object created in CONVERT.PRG. It must be present
  31. *- for the transporter to work properly
  32. *-
  33. * "g_scrndbf" is the name of the file to transport.  It will usually be in some sort
  34. * of database format (e.g., SCX/PJX/MNX) but might also be a FoxBASE+ or FoxPro 1.02
  35. * report or label file, which is not a database.
  36. *
  37. * "tp_filetype" specifies what kind of file "g_scrndbf" is.  Allowable values are
  38. * found in the #DEFINE constants immediately below.  Note that the Transporter usually
  39. * does not use this value and instead figures out what kind of file it is being
  40. * presented with by counting the fields in the database.  For FoxBASE+ and FoxPro 1.02 files,
  41. * however, the Transporter does use this parameter to convert the report or label
  42. * data into 2.0 database format before transporting to Windows.  Note that the FoxBASE+
  43. * types are never actually passed in m.tp_filetype.  They are inferred in GetOldReportType
  44. * and GetOldLabelTypefrom the ID byte in the report/label files.
  45.  
  46. * The "dummy" parameter is not used.  At one point in the developement of the Transporter,
  47. * another parameter was passed.
  48.  
  49. * gAShowMe is an array of logical values that remember for which file types
  50. * the transporter dialog should be shown.
  51.  
  52. * If gAShowMe[n,1] for a particular filetype is .F., the Transporter does not display its 
  53. * dialogs and assumes default values.  
  54. *
  55. * Only the main transporter dialogs are suppressed, so this is not a general
  56. * mechanism for skipping all the dialogs, especially those that are displayed for
  57. * projects, FoxBASE+ and early versions of FoxPro files. Further, the thermometer
  58. * is still displayed.
  59. *
  60. * gAShowMe[n,1] controls whether or not the transporter
  61. * dialog is shown for that particular file type. This value can be switched by the user
  62. * via radio buttons in the transporter dialog. gAShowMe[n,2] determines if the file
  63. *- is to be transported (1), or used "as is". gAShowMe[n,3] remembers the chosen font (jd 3/13/95)
  64.  
  65. * added gOTherm. If object, will try, will call an update method for thermometer, instead
  66. * of using transporter's thermometer (jd 2/2/95)
  67.  
  68. *- there is now a transprt.h file, which includes all of the #DEFINES
  69. *- also, text strings are now localizable (11/1/95 jd)
  70.  
  71. *- 3.0 FRX files being moved from one platform to another (e.g., Mac -> Win) 
  72. *- are now run through the converter, since they are essentially 2.6 files with an extra
  73. *- field and some new objects (11/1/95 jd)
  74.  
  75. PRIVATE ALL EXCEPT gopjx
  76.  
  77. IF SET("TALK") = "ON"
  78.    SET TALK OFF
  79.    m.talkset = "ON"
  80. ELSE
  81.    m.talkset = "OFF"
  82. ENDIF
  83. m.pcount = PARAMETERS()
  84.  
  85. gError = .F.
  86.  
  87. IF TYPE("gAShowMe[1,1]") # "L"
  88.     RELEASE gAShowMe
  89.     DIMENSION gAShowMe[N_MAXTRANFILETYPES,9]
  90.     *- don't ask for any file type
  91.     LOCAL ictr
  92.     FOR ictr = 1 TO ALEN(gAShowMe,1)
  93.         gAShowMe[ictr,1] = .T.
  94.         gAShowMe[ictr,2] = 1
  95.         gAShowMe[ictr,3] = ""        && font name
  96.         gAShowMe[ictr,4] = 0        && font size
  97.         gAShowMe[ictr,5] = ""        && font style
  98.         gAShowMe[ictr,6] = ""        && from platform
  99.         gAShowMe[ictr,7] = .T.        && convert new objects
  100.         gAShowMe[ictr,8] = .T.        && convert more recently modified objects
  101.         gAShowMe[ictr,9] = .F.        && replace all objects
  102.     NEXT
  103. ENDIF
  104.  
  105. DO CASE
  106. CASE _MAC
  107.    m.g_pophght      = 1.500    && popup height
  108.    m.g_vpopup       = 0.750    && vpos adjustment going from DOS to Mac
  109. CASE _WINDOWS
  110.    m.g_pophght      = 1.538
  111.    m.g_vpopup       = 0.906
  112. OTHERWISE
  113.    m.g_pophght      = 3.000
  114.    m.g_vpopup       = 0.906
  115. ENDCASE
  116.  
  117. IF _MAC
  118.    m.g_pixelsize  = 72       && logical pixels per inch
  119.    m.g_bandheight = ((14/m.g_pixelsize) * 10000)
  120.    m.g_bandfudge  =  3262
  121. ELSE
  122.    m.g_pixelsize  = 96       && logical pixels per inch
  123.    m.g_bandheight = ((19/m.g_pixelsize) * 10000)
  124.    m.g_bandfudge  =  4350
  125. ENDIF
  126. * Used in bandinfo() to adjust band vpos's when transporting to MS-DOS.
  127. * These calculations must match the ones immediately above.
  128. m.g_macbandheight = ((14/72) * 10000)
  129. m.g_winbandheight = ((19/96) * 10000)
  130.  
  131.  
  132. * Check mark for selecting items to be transported
  133. IF _MAC
  134.    m.g_checkmark = "X"
  135. ELSE
  136.    m.g_checkmark = '√'
  137. ENDIF
  138.  
  139.  
  140. PUSH KEY CLEAR
  141.  
  142. *
  143. * Declare Environment Variables so that they are visible throughout the program
  144. *
  145. STORE "" TO m.cursor, m.consol, m.bell, m.exact, m.escape, m.onescape, m.safety, ;
  146.    m.fixed, m.print, m.unqset, m.udfparms, m.exclusive, m.onerror, ;
  147.    m.trbetween, m.comp, m.device, m.status, m.g_fromplatform, m.choice, ;
  148.    m.g_fromobjonlyalias, m.g_boxeditemsalias, m.g_tempalias, m.mtopic, m.rbord, m.mcollate, ;
  149.    m.mmacdesk, m.fields, mfieldsto
  150. STORE 0 TO m.deci, m.memowidth, m.currarea
  151. STORE .F. to m.g_char2grph, m.g_grph2char, m.g_grph2grph, m.g_char2char
  152.  
  153. *- index for gAShowMe
  154. m.g_tpFileIndx = 1
  155.  
  156. DO setall
  157.  
  158. m.g_look2d           = .F.  && are buttons 2D or 3D?
  159.  
  160. m.g_filetype         =  0  && screen, report, label, etc.
  161.  
  162. * Set up these variables for scoping reasons here.  SetCtrl assigns them
  163. * their real values.
  164. m.g_ctrlfface        = ""
  165. m.g_ctrlfsize        = 0
  166. m.g_ctrlfstyle       = ""
  167. m.g_windfface        = ""
  168. m.g_windfsize        = 0
  169. m.g_windfstyle       = ""
  170. m.g_winbtnheight     = 0
  171. m.g_macbtnheight     = 0
  172. m.g_macbtnface       = ""
  173. m.g_macbtnsize       = 0
  174. m.g_macbtnstyle      = ""
  175. m.g_winbtnface       = ""
  176. m.g_winbtnsize       = 0
  177. m.g_winbtnstyle      = ""
  178. m.g_btnheight        = 0   && default btn height for the current platform
  179.  
  180. m.g_dfltfface        = ""
  181. m.g_dfltfsize        = 0
  182. m.g_dfltfstyle         = ""
  183. m.g_thermface        = ""
  184. m.g_thermsize        = 0
  185. m.g_thermstyle         = ""
  186.  
  187. * These fonts are not necessarily used in the report, but their cxChar and
  188. * cyChar are somewhat larger than the ones that are used.  This provides a
  189. * "fudge factor" to make sure the fields are wide and tall enough.
  190. IF _MAC
  191.    m.g_rptfface            = "Courier"
  192.    m.g_rptfsize            = 13
  193.    m.g_rptfstyle           = 0
  194.    m.g_rpttxtfontstyle     = ""
  195. ELSE
  196.    m.g_rptfface            = "Courier"
  197.    m.g_rptfsize            = 10
  198.    m.g_rptfstyle           = 0
  199.    m.g_rpttxtfontstyle     = ""
  200. ENDIF
  201. DO CASE
  202. CASE _WINDOWS
  203.    m.g_rptlinesize      = (FONTMETRIC(1, m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  204.    m.g_rptcharsize      = (FONTMETRIC(6, m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  205. CASE _MAC
  206.    * This factor is based on a cyChar of 13 for Geneva, 10 (Bold and regular)
  207.    * No fudge factor needed for cyChar.
  208.    m.g_rptlinesize      = (13/72) * 10000
  209.    * This factor is based on a cxChar of 7 for Geneva, 10 Bold,
  210.    * 72 pixels per inch for the Mac, and a 20% fudge factor.
  211.    m.g_rptcharsize      = ((7/72)  * 10000) * 1.2
  212. ENDCASE
  213.  
  214. DO setctrl   && set control/window measurement fonts, button height, etc.
  215.  
  216. * Font style for Transporter dialogs--not the converted screens, but the
  217. * dialogs in the Transporter itself.
  218. IF _MAC
  219.    m.g_tdlgface   = "Geneva"
  220.    m.g_tdlgsize   = 10.000
  221.    m.g_tdlgstyle  = "BT"
  222.    m.g_tdlgsty1   = "B"
  223.    m.g_tdlgsty2   = ""
  224.    m.g_tdlgbtn    = 1.500        && button height
  225.  
  226.    m.g_smface     = "Geneva"   && small font
  227.    m.g_smsize     = 10
  228.    m.g_smstyle    = "T"
  229.    m.g_smsty1     = ""
  230. ELSE
  231.    m.g_tdlgface   = "MS Sans Serif"
  232.    m.g_tdlgsize   = 8.000
  233.    m.g_tdlgstyle  = "BT"
  234.    m.g_tdlgsty1   = "BO"
  235.    m.g_tdlgsty2   = ""
  236.    m.g_tdlgbtn    = 1.769
  237.  
  238.    m.g_smface   = "MS Sans Serif"
  239.    m.g_smsize   = 8.000
  240.    m.g_smstyle  = "BT"
  241.    m.g_smsty1   = "BO"
  242. ENDIF
  243.  
  244. m.g_fontset          = .F.      && default font changed?
  245.  
  246. * Font for object selection list
  247. IF _MAC
  248.    m.g_foxfont          = "Courier"
  249.    m.g_foxfsize         = 10
  250. ELSE
  251.    m.g_foxfont          = "Foxfont"
  252.    m.g_foxfsize         = 9
  253. ENDIF
  254. m.g_normstylenum        = 0
  255. m.g_boldstylenum        = 1
  256.  
  257. m.g_fromplatform     = " "
  258. m.g_toplatform       = " "
  259. m.g_windheight       = 1
  260. m.g_windwidth        = 1
  261. m.g_thermwidth       = 0
  262. m.g_mercury          = 0
  263. m.g_20alias          = ""
  264. m.g_status           = 0    && records error status
  265. m.g_energize         = .F.  && does button say "Energize?"
  266. m.g_norepeat         = .F.
  267.  
  268. m.g_allobjects       = .T.  && what objects are we transporting?
  269. m.g_newobjects       = .T.
  270. m.g_snippets         = .T.
  271. m.g_newobjmode       = .F.
  272.  
  273. m.g_scrnalias        = ""
  274. m.g_updenviron       = .F.  && have we transported the environment records?
  275. m.g_tpselcnt         = 0    && number of entries in the tparray selection array
  276.  
  277. m.g_boxstrg = ['─','─','│','│','┌','┐','└','┘','─','─','│','│','┌','┐','└','┘']
  278.  
  279. m.g_returncode       = c_cancel
  280.  
  281. * Code pages we're translating to/from.
  282. m.g_tocodepage       = 0
  283. m.g_fromcodepage     = 0
  284.  
  285. *- index for gAShowMe
  286. m.g_tpFileIndx = 1
  287.  
  288. * Dimension the array of records to be transported.  This is the picklist of new and
  289. * updated objects.
  290. DIMENSION tparray[1,2]
  291.  
  292. DIMENSION g_lastobjectline[2]
  293. g_lastobjectline = 0
  294. m.g_tempindex = "S" + SUBSTR(LOWER(SYS(3)),2,8) + ".cdx"
  295.  
  296. m.onerror = ON("ERROR")
  297. ON ERROR DO errorhandler WITH MESSAGE(), LINENO(), c_error3
  298.  
  299. IF m.pcount < 2
  300.    DO ErrorHandler WITH T_NOSTAND_LOC,LINENO(),c_error3
  301.    RETURN
  302. ENDIF
  303.  
  304. * Record fonts available on the current platform
  305. DIMENSION g_fontavail[1]
  306. =afont(g_fontavail)
  307.  
  308. DIMENSION g_fontmap[c_mapfonts,6]
  309. DO initfontmap   && initialize font mapping array
  310.  
  311. *
  312. * Make sure we have a file name we can deal with.  Prompt if the file cannot be found.
  313. *
  314. IF TYPE("m.g_scrndbf") != "C"
  315.    m.g_scrndbf = ""
  316.    DO assert WITH .T., T_INVALIDSCR_LOC
  317. ENDIF
  318. m.g_scrndbf = UPPER(ALLTRIM(m.g_scrndbf))
  319. DO CASE
  320. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "SCX"
  321.    IF !FILE(m.g_scrndbf)
  322.       m.g_scrndbf = GETFILE("SCX", T_WHEREIS_LOC+strippath(m.g_scrndbf))
  323.    ENDIF
  324. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "FRX"
  325.    IF !FILE(m.g_scrndbf)
  326.       m.g_scrndbf = GETFILE("FRX", T_WHEREIS_LOC+strippath(m.g_scrndbf))
  327.    ENDIF
  328. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "LBX"
  329.    IF !FILE(m.g_scrndbf)
  330.       m.g_scrndbf = GETFILE("LBX", T_WHEREIS_LOC+strippath(m.g_scrndbf))
  331.    ENDIF
  332. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "PJX"
  333.    IF !FILE(m.g_scrndbf)
  334.       m.g_scrndbf = GETFILE("PJX", T_WHEREIS_LOC+strippath(m.g_scrndbf))
  335.    ENDIF
  336. OTHERWISE
  337.    IF !FILE(m.g_scrndbf)
  338.       m.g_scrndbf = GETFILE("SCX|FRX|LBX|PJX", T_SELTRANS_LOC,T_TRANSPORT_LOC)
  339.    ENDIF
  340. ENDCASE
  341.  
  342. IF !FILE(m.g_scrndbf) OR EMPTY(m.g_scrndbf)
  343.    DO cleanup
  344.    RETURN .F.
  345. ENDIF
  346.  
  347. DO putwinmsg WITH T_TITLE_LOC +": " + LOWER(strippath(m.cRealName))
  348.  
  349. DO setversion  WITH g_toplatform
  350.  
  351. m.g_tocodepage = settocp()  && based on runtime platform
  352.  
  353. *- set index for which filetype
  354. DO CASE
  355.     CASE INLIST(m.tp_filetype,c_25scxtype,c_20scxtype)
  356.         m.g_tpFileIndx = N_TRANFILE_SCX
  357.     CASE INLIST(m.tp_filetype,c_25frxtype,c_20frxtype,c_25lbxtype,c_20lbxtype,c_frx102modi,c_frx102repo,c_lbx102modi, c_lbx102repo)
  358.         m.g_tpFileIndx = N_TRANFILE_FRX
  359.     CASE INLIST(m.tp_filetype,c_20pjxtype)
  360.         m.g_tpFileIndx = N_TRANFILE_PJX
  361.     OTHERWISE
  362.         m.g_tpFileIndx = N_TRANFILE_SCX
  363. ENDCASE
  364.  
  365. *- added mac case (jd 11/13/95)
  366. IF !EMPTY(gAShowMe[m.g_tpFileIndx,3])
  367.    m.g_dfltfface = m.gAShowMe[m.g_tpFileIndx,3]
  368.    m.g_dfltfsize = m.gAShowMe[m.g_tpFileIndx,4]
  369.    m.g_dfltfstyle = m.gAShowMe[m.g_tpFileIndx,5]
  370. ELSE
  371.     DO CASE
  372.         CASE _windows
  373.             m.g_dfltfface  = "MS Sans Serif"
  374.             m.g_dfltfsize  = 8
  375.             m.g_dfltfstyle = "B"
  376.         CASE _mac
  377.             m.g_dfltfface  = "Geneva"
  378.             m.g_dfltfsize  = 10
  379.             m.g_dfltfstyle = "N"
  380.     ENDCASE
  381. ENDIF
  382.  
  383. * If we've been passed an old format report or label form, see if it is a FoxPro 1.02
  384. * form, a FoxBASE+ form, or an unknown form.
  385. * Convert FoxPro 1.02 or FoxBASE+ DOS reports into 2.5/2.6 DOS reports
  386. IF INLIST(m.tp_filetype,c_frx102modi,c_frx102repo,c_lbx102modi, c_lbx102repo)
  387.  
  388.    IF INLIST(m.tp_filetype,c_frx102modi,c_frx102repo)
  389.       m.tp_filetype = getoldreporttype()   && FoxPro 1.02 or FoxBASE+ report?
  390.    ELSE
  391.       m.tp_filetype = getoldlabeltype()    && FoxPro 1.02 or FoxBASE+ label?
  392.    ENDIF
  393.  
  394.    m.g_fromcodepage = c_doscp
  395.  
  396.    IF doupdate()           && prompt to convert to 2.5 format; sets m.g_filetype
  397.       DO CASE
  398.       CASE INLIST(m.tp_filetype,c_frx102modi,c_frx102repo)
  399.          * FoxPro 1.02 report
  400.          m.g_scrndbf = cvrt102frx(m.g_scrndbf, m.tp_filetype)
  401.       CASE INLIST(m.tp_filetype,c_fbprptmodi,c_fbprptrepo)
  402.          * FoxBASE+ report
  403.          m.g_scrndbf = cvrtfbprpt(m.g_scrndbf, m.tp_filetype)
  404.       CASE INLIST(m.tp_filetype,c_lbx102modi,c_lbx102repo)
  405.          * FoxPro 1.02 label
  406.          m.g_scrndbf = cvrt102lbx(m.g_scrndbf, m.tp_filetype)
  407.       CASE INLIST(m.tp_filetype,c_fbplblmodi,c_fbplblrepo)
  408.          * FoxBASE+ label
  409.          m.g_scrndbf = cvrtfbplbl(m.g_scrndbf, m.tp_filetype)
  410.         CASE m.tp_filetype = c_db4type
  411.             WAIT WINDOW T_CONVFRX_LOC NOWAIT
  412.             DO cleanup WITH .T.
  413.       OTHERWISE
  414.          DO errorhandler WITH T_UNKNOWNFRX_LOC,LINENO(),c_error3
  415.       ENDCASE
  416.    ELSE
  417.       DO cleanup
  418.       RETURN c_cancel
  419.    ENDIF
  420. ENDIF
  421.  
  422. * Open the screen/report/label/project file
  423. IF !opendbf(m.g_scrndbf)
  424.    m.g_returncode = c_cancel
  425. ENDIF
  426.  
  427. *
  428. * We have three basic conversion cases.  These are transporting a 2.0 file to a
  429. * graphical 2.5 platform (structure change and conversion), converting a 2.0 file
  430. * to a character 2.5 platform (structure change) and transporting a 2.5 platform
  431. * to another 2.5 platform (character/graphical conversion).  This case statement
  432. * calls the appropriate dialog routines and makes sure we have done all the
  433. * preparation (like creating the cursor we actually work with.)
  434. *
  435. * The 1.02 and FoxBASE+ reports/labels are handled in basically the same way.
  436. * They get their own cases in this construct since we don't want to prompt the
  437. * user twice for conversion.  Almost all of the actual conversion of these files
  438. * has already taken place, in the "cvrt102frx" procedure (and related procedures)
  439. * called above.
  440. *
  441. * Conversion of 2.0 project files is handled in its own case also.
  442. *
  443. DO CASE
  444. CASE INLIST(m.tp_filetype,c_frx102repo,c_fbprptrepo,c_lbx102repo,c_fbplblrepo) ;
  445.        AND (_WINDOWS OR _MAC)
  446.    * FoxPro 1.02 or FoxBASE+ report/label opened via REPORT/LABEL FORM.  At this point,
  447.    * we've already converted the old format form into FoxPro 2.5 DOS format.
  448.    * Finish conversion, but don't transport it to Windows.
  449.    m.g_fromplatform = c_dosname
  450.    m.g_fromcodepage = setfromcp(m.g_fromplatform)
  451.    m.g_returncode = c_yes
  452.    DO starttherm WITH c_converting,g_filetype
  453.    DO putwinmsg WITH c_converting + " " + LOWER(strippath(m.cRealName))
  454.    DO converter
  455.  
  456. CASE INLIST(m.tp_filetype,c_frx102modi,c_fbprptmodi,c_lbx102modi,c_fbplblmodi) ;
  457.        AND (_WINDOWS OR _MAC)
  458.    * FoxPro 1.02 or FoxBASE+ report/label opened via MODIFY REPORT/LABEL. At this point,
  459.    *  we've already converted the old format form into FoxPro 2.5 DOS format.
  460.    * Finish conversion, and then transport it to Windows.
  461.    m.g_fromplatform = c_dosname
  462.    m.g_fromcodepage = setfromcp(m.g_fromplatform)
  463.    m.g_returncode = c_yes
  464.    DO putwinmsg WITH c_converting + " " + LOWER(strippath(m.cRealName))
  465.    DO converter
  466.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.cRealName))
  467.    DO import
  468.    DO synchtime WITH m.g_toplatform, m.g_fromplatform
  469.  
  470. CASE ((FCOUNT() = c_20scxfld OR FCOUNT() = c_20frxfld OR FCOUNT() = c_20lbxfld);
  471.       AND (_DOS OR _UNIX))
  472.    * Convert it to a DOS report, but don't transport it to Windows
  473.    DO CASE
  474.    CASE !doupdate()  && displays dialog and sets g_toPlatform
  475.       m.g_returncode = c_cancel
  476.    OTHERWISE
  477.       m.g_fromplatform = c_dosname
  478.       m.g_fromcodepage = setfromcp(m.g_fromplatform)
  479.       m.g_returncode = c_yes
  480.       DO starttherm WITH c_converting,g_filetype
  481.       DO converter
  482.    ENDCASE
  483.  
  484. CASE (FCOUNT() = c_20scxfld OR FCOUNT() = c_20frxfld ;
  485.       OR FCOUNT() = c_20lbxfld) AND (_WINDOWS OR _MAC)
  486.  
  487.    * Convert it to DOS and then transport it to Windows
  488.    m.choice = converttype(.T.)
  489.    m.g_fromcodepage = setfromcp(m.g_fromplatform)
  490.  
  491.    *- added this (jd 2/2/95)
  492.    m.g_fromplatform = c_dosname
  493.  
  494.    DO CASE
  495.    CASE m.choice = c_yes
  496.       m.g_returncode = c_yes
  497.       DO converter
  498.       DO import
  499.       DO synchtime WITH m.g_toplatform, m.g_fromplatform
  500.    CASE m.choice = c_no
  501.       m.g_returncode = c_no
  502.  
  503.    OTHERWISE
  504.       m.g_returncode = c_cancel
  505.    ENDCASE
  506.  
  507. *- support 3.0 FRX file (11/1/95 jd)
  508. CASE FCOUNT() = c_scxfld OR FCOUNT() = c_frxfld OR FCOUNT() = c_frx30fld
  509.    m.choice = converttype(.F.)
  510.    DO CASE
  511.    CASE m.choice = c_yes
  512.       m.g_returncode = c_yes
  513.       DO makecursor
  514.       DO import
  515.       IF m.g_returncode <> c_cancel
  516.          * This might happen if the user picked "Cancel" on the screen that lets
  517.          * him/her uncheck specific items.
  518.          SELECT (m.g_scrnalias)
  519.          DO synchtime WITH m.g_toplatform, m.g_fromplatform
  520.       ENDIF
  521.    CASE m.choice = c_no
  522.       m.g_returncode = c_no
  523.  
  524.    OTHERWISE
  525.       m.g_returncode = c_cancel
  526.    ENDCASE
  527. CASE FCOUNT() = c_20pjxfld
  528.    IF versnum() > "2.5"
  529.       * Identify fields that contain binary data.  These should not be codepage-translated.
  530.       * Note that files opened via low level routines (e.g., FoxPro 1.02 reports) will not
  531.       * be codepage-translated automatically.  Strings in those files that require codepage
  532.       * translation will be codepage translated explicitly below.
  533.       SET NOCPTRANS TO arranged, object, symbols, devinfo
  534.    ENDIF
  535.  
  536.    * Converting a 2.0 project to 2.5 format
  537.    IF !doupdate()                 && displays dialog and sets g_toPlatform
  538.       m.g_returncode = c_cancel
  539.    ELSE
  540.       m.g_fromplatform = c_dosname
  541.       m.g_fromcodepage = setfromcp(m.g_fromplatform)
  542.       m.g_returncode = c_yes
  543.       DO putwinmsg WITH c_converting + " " + LOWER(strippath(m.cRealName))
  544.       DO starttherm WITH c_converting,g_filetype
  545.       DO converter
  546.    ENDIF
  547. CASE FCOUNT() = c_pjxfld
  548.    * 2.5 project passed to us by mistake--shouldn't ever happen.
  549.    WAIT WINDOW T_TRANSNOTHING_LOC NOWAIT
  550.    m.g_returncode = c_cancel
  551. OTHERWISE
  552.    DO errorhandler WITH T_INVFILEFORMAT_LOC, LINENO(), c_error3
  553.    m.g_returncode = c_cancel
  554. ENDCASE
  555.  
  556. DO cleanup
  557.  
  558. RETURN m.g_returncode
  559.  
  560. *!*****************************************************************************
  561. *!
  562. *!       Function: OPENDBF
  563. *!
  564. *!      Called by: TRANSPRT.PRG
  565. *!
  566. *!*****************************************************************************
  567. FUNCTION opendbf
  568. PARAMETER fname
  569. m.g_scrnalias = "S"+SUBSTR(LOWER(SYS(3)),2,8)
  570. SELECT 0
  571. USE (m.fname) AGAIN ALIAS (m.g_scrnalias)
  572. IF RECCOUNT() = 0
  573.    WAIT WINDOW T_NORECS_LOC NOWAIT
  574.    RETURN .F.
  575. ENDIF
  576. RETURN .T.
  577.  
  578. *
  579. * doupdate - Ask the user if a 2.0 screen/report/label should be updated to 2.5 format.
  580. *
  581. *!*****************************************************************************
  582. *!
  583. *!       Function: DOUPDATE
  584. *!
  585. *!      Called by: TRANSPRT.PRG
  586. *!
  587. *!          Calls: STRUCTDIALOG()     (function  in TRANSPRT.PRG)
  588. *!
  589. *!*****************************************************************************
  590. FUNCTION doupdate
  591. PRIVATE m.result
  592.  
  593. DO CASE
  594. CASE INLIST(m.tp_filetype,c_frx102modi, c_frx102repo)
  595.    m.g_filetype = c_report
  596.    m.result = structdialog(T_COMVPRMPT1_LOC) &&"Convert 1.02 report file to 2.6 format?"
  597.  
  598. CASE INLIST(m.tp_filetype,c_fbprptmodi, c_fbprptrepo)
  599.    m.g_filetype = c_report
  600.    m.result = structdialog(T_COMVPRMPT2_LOC) &&"Convert FoxBASE+/dBASE III report file to FoxPro 2.6 format?"
  601.  
  602. CASE INLIST(m.tp_filetype,c_lbx102modi, c_lbx102repo)
  603.    m.g_filetype = c_label
  604.    m.result = structdialog(T_COMVPRMPT3_LOC) &&"Convert 1.02 label file to 2.6 format?"
  605.  
  606. CASE INLIST(m.tp_filetype,c_fbplblmodi, c_fbplblrepo)
  607.    m.g_filetype = c_label
  608.    m.result = structdialog(T_COMVPRMPT4_LOC) &&"Convert FoxBASE+/dBASE III label file to FoxPro 2.6 format?"
  609.  
  610. CASE FCOUNT() = c_20scxfld
  611.    m.g_filetype = c_screen
  612.    m.result = structdialog(T_COMVPRMPT5_LOC) &&"Convert 2.0 screen file to 2.6 format?"
  613.  
  614. CASE FCOUNT() = c_20frxfld
  615.    m.g_filetype = c_report
  616.    m.result = structdialog(T_COMVPRMPT6_LOC) &&"Convert 2.0 report file to 2.6 format?"
  617.  
  618. CASE FCOUNT() = c_20lbxfld
  619.    RETURN .F.
  620.  
  621. CASE FCOUNT() = c_20pjxfld
  622.    m.g_filetype = c_project
  623.    m.result = structdialog(T_COMVPRMPT7_LOC) &&"Convert 2.0 project file to 2.6 format?"
  624. CASE m.tp_filetype = c_db4type
  625.     m.result = .T.
  626.  
  627. OTHERWISE
  628.    DO errorhandler WITH T_UNKOPERATION_LOC, LINENO(), c_error3
  629. ENDCASE
  630.  
  631. RETURN m.result
  632.  
  633. *
  634. * converttype - Display the dialog used when converting between 2.5 platforms
  635. *
  636. *!*****************************************************************************
  637. *!
  638. *!       Function: CONVERTTYPE
  639. *!
  640. *!      Called by: TRANSPRT.PRG
  641. *!
  642. *!          Calls: CLEANUP            (procedure in TRANSPRT.PRG)
  643. *!               : SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  644. *!
  645. *!           Uses: M.G_SCRNALIAS
  646. *!
  647. *!*****************************************************************************
  648. FUNCTION converttype
  649. PARAMETER m.twooh
  650. PRIVATE m.i, m.pcount, m.nplatforms
  651.  
  652. IF m.twooh  && If it's a 2.0 file, there is only one platform to convert from.
  653.    DIMENSION platforms[1]
  654.    platforms[1] = c_foxdos_loc
  655.  
  656.    DO CASE                           && Remember the type of file we are converting
  657.    CASE INLIST(m.tp_filetype,c_frx102modi,c_frx102repo,c_fbprptmodi,c_fbprptrepo)
  658.       m.g_filetype = c_report
  659.  
  660.    CASE FCOUNT() = c_20scxfld
  661.       m.g_filetype = c_screen
  662.  
  663.    CASE FCOUNT() = c_20frxfld
  664.       m.g_filetype = c_report
  665.  
  666.    CASE FCOUNT() = c_20lbxfld
  667.       m.g_filetype = c_label
  668.  
  669.    CASE FCOUNT() = c_20pjxfld
  670.       m.g_filetype = c_project
  671.    ENDCASE
  672. ELSE
  673.    IF FCOUNT() = c_scxfld                && Remember the type of file we are converting
  674.       m.g_filetype = c_screen
  675.    ELSE
  676.       IF UPPER(RIGHT(m.g_scrndbf, 4)) = ".LBX"
  677.          LOCATE FOR objtype = c_ot20label OR ;
  678.             ((platform = c_winname OR platform = c_macname) AND ;
  679.             objtype = c_otheader AND BOTTOM)
  680.          IF FOUND()
  681.             m.g_filetype = c_label
  682.          ELSE
  683.             m.g_filetype = c_report
  684.          ENDIF
  685.       ELSE
  686.          m.g_filetype = c_report
  687.       ENDIF
  688.    ENDIF
  689.  
  690.    * See if this file has the special warning the Mac writes to reports
  691.     IF m.g_filetype = c_report
  692.        LOCATE FOR platform = "WINDOWS" AND iserrormsg(expr)
  693.         IF FOUND()
  694.             GOTO TOP
  695.             LOCATE FOR platform = "WINDOWS"
  696.             DELETE WHILE platform = "WINDOWS"
  697.             PACK
  698.         ENDIF
  699.         GOTO TOP
  700.     ENDIF
  701.  
  702.    * Get a list of the platforms in this file.
  703.    SELECT DISTINCT platform ;
  704.       FROM (m.g_scrnalias) ;
  705.       WHERE !DELETED() ;
  706.       INTO ARRAY availplatforms
  707.    m.nplatforms = _TALLY
  708.    m.pcount = 0
  709.  
  710.    IF m.nplatforms > 0
  711.       m.g_fromplatform = availplatforms[1]
  712.  
  713.       FOR i = 1 TO m.nplatforms
  714.          DO CASE
  715.          CASE ATC('DOS',availplatforms[m.i]) > 0 AND !_DOS
  716.             m.pcount = m.pcount + 1
  717.  
  718.          CASE ATC('WINDOWS',availplatforms[m.i]) > 0 AND !_WINDOWS
  719.             m.pcount = m.pcount + 1
  720.  
  721.          CASE ATC('UNIX',availplatforms[m.i]) > 0 AND !_UNIX
  722.             m.pcount = m.pcount + 1
  723.  
  724.          CASE ATC('MAC',availplatforms[m.i]) > 0 AND !_MAC
  725.             m.pcount = m.pcount + 1
  726.          ENDCASE
  727.       ENDFOR
  728.       RELEASE availplatforms
  729.    ENDIF
  730.  
  731.    IF m.nplatforms = 0 OR m.pcount = 0     && There isn't anything to convert from.
  732.       WAIT WINDOW T_TRANSNOTHING_LOC  NOWAIT
  733.       DO cleanup
  734.       RETURN c_cancel
  735.    ENDIF
  736. ENDIF
  737.  
  738. *   Call the dialog routine appropriate to this file type.
  739. DO CASE                        && Ask the user what we should do.
  740. CASE m.g_filetype = c_screen
  741.    RETURN scxfrxdialog("SCX")
  742. CASE m.g_filetype = c_report
  743.    DO setrptfont
  744.    RETURN scxfrxdialog("FRX")
  745. CASE m.g_filetype = c_label
  746.    DO setrptfont
  747.    RETURN scxfrxdialog("LBX")
  748. ENDCASE
  749. RETURN c_cancel
  750.  
  751. *
  752. * setversion - set global variable m.g_toPlatform with the name of the platform
  753. *            we are running on.
  754. *
  755. *!*****************************************************************************
  756. *!
  757. *!      Procedure: SETVERSION
  758. *!
  759. *!      Called by: TRANSPRT.PRG
  760. *!
  761. *!          Calls: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  762. *!
  763. *!*****************************************************************************
  764. PROCEDURE setversion
  765. PARAMETER m.to
  766. DO CASE
  767. CASE _WINDOWS
  768.    m.to = c_winname
  769. CASE _MAC
  770.    m.to = c_macname
  771. CASE _UNIX
  772.    m.to = c_unixname
  773. CASE _DOS
  774.    m.to = c_dosname
  775. OTHERWISE
  776.    DO errorhandler WITH T_UNKFOXVER_LOC, LINENO(), c_error3
  777. ENDCASE
  778. *!*****************************************************************************
  779. *!
  780. *!      Procedure: settocp
  781. *!
  782. *!*****************************************************************************
  783. PROCEDURE settocp
  784. DO CASE
  785. CASE _WINDOWS
  786.    RETURN c_wincp
  787. CASE _MAC
  788.    RETURN c_maccp
  789. CASE _UNIX
  790.    RETURN c_unixcp
  791. CASE _DOS
  792.    RETURN c_doscp
  793. OTHERWISE
  794.    DO errorhandler WITH T_UNKFOXVER_LOC, LINENO(), c_error3
  795. ENDCASE
  796.  
  797. *
  798. * import - Do the import.
  799. *
  800. *!*****************************************************************************
  801. *!
  802. *!      Procedure: IMPORT
  803. *!
  804. *!      Called by: TRANSPRT.PRG
  805. *!
  806. *!          Calls: EMPTYPLATFORM()    (function  in TRANSPRT.PRG)
  807. *!               : GETCHARSUPPRESS()  (function  in TRANSPRT.PRG)
  808. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  809. *!               : GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  810. *!
  811. *!           Uses: M.G_SCRNALIAS
  812. *!
  813. *!*****************************************************************************
  814. PROCEDURE import
  815.  
  816. IF m.g_fromplatform = m.g_toplatform
  817.    * This shouldn't be possible
  818.    DO assert WITH .T.,T_SAMELINE_LOC+TRIM(STR(LINENO()))
  819.    RETURN
  820. ELSE
  821.    *   If we are converting everything, remove all records for the target
  822.    *   platform.
  823.    IF m.g_allobjects AND !emptyplatform(m.g_toplatform)
  824.       * We need to copy the records we want to a temporary file, clear our cursor
  825.       * and copy the records back since you can't pack a cursor and SELECT creates
  826.       * a read only cursor.
  827.         LOCAL cOldCPTrans
  828.  
  829.       m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  830.       SELECT * FROM (m.g_scrnalias) ;
  831.          WHERE !DELETED() AND platform <> m.g_toplatform ;
  832.          INTO TABLE (m.g_tempalias)
  833.  
  834.         cOldCPTrans = SET("NOCPTRANS")
  835.         SET NOCPTRANS TO tag, tag2
  836.         SELECT (m.g_scrnalias)
  837.         ZAP
  838.  
  839.         APPEND FROM (m.g_tempalias)
  840.         SET NOCPTRANS TO &cOldCPTrans
  841.       SELECT (m.g_tempalias)
  842.       USE
  843.       DELETE FILE (m.g_tempalias+".dbf")
  844.       DELETE FILE (m.g_tempalias+".fpt")
  845.       SELECT (m.g_scrnalias)
  846.    ENDIF
  847.  
  848.    IF !g_allobjects AND emptyplatform(m.g_toplatform)
  849.     *- there are no records for the "to" platform, so force all objects (jd 5/20/95)
  850.     m.g_allobjects = .T.
  851.    ENDIF
  852.  
  853.    m.g_char2grph =  (m.g_toplatform = 'WINDOWS' OR m.g_toplatform = 'MAC') AND ;
  854.       (m.g_fromplatform = 'DOS' OR m.g_fromplatform = 'UNIX')
  855.    m.g_grph2grph =  (m.g_toplatform = 'WINDOWS' OR m.g_toplatform = 'MAC') AND ;
  856.           (m.g_fromplatform = 'WINDOWS' OR m.g_fromplatform = 'MAC')
  857.    m.g_grph2char =  (m.g_toplatform = 'DOS' OR m.g_toplatform = 'UNIX') AND ;
  858.       (m.g_fromplatform = 'WINDOWS' OR m.g_fromplatform = 'MAC')
  859.    m.g_char2char =  (m.g_toplatform = 'DOS' OR m.g_toplatform = 'UNIX') AND ;
  860.       (m.g_fromplatform = 'DOS' OR m.g_fromplatform = 'UNIX')
  861. ENDIF
  862.  
  863. IF g_filetype = c_report
  864.    m.g_norepeat = getcharsuppress()
  865. ENDIF
  866.  
  867. *  Pass control to the control routine appropriate for the direction we are converting.
  868. DO CASE
  869. CASE m.g_char2grph
  870.    DO chartographic
  871. CASE m.g_grph2char
  872.    DO graphictochar
  873. CASE m.g_grph2grph
  874.    DO graphictographic
  875. ENDCASE
  876. RETURN
  877.  
  878. *
  879. * GraphicToChar - Converts everything, new objects or changed snippets from a grpahical
  880. *      platform to a character platform.
  881. *
  882. *!*****************************************************************************
  883. *!
  884. *!      Procedure: GRAPHICTOCHAR
  885. *!
  886. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  887. *!
  888. *!          Calls: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  889. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  890. *!               : STARTTHERM         (procedure in TRANSPRT.PRG)
  891. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  892. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  893. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  894. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  895. *!
  896. *!*****************************************************************************
  897. PROCEDURE graphictochar
  898. IF m.g_allobjects
  899.    *  Start the thermometer with the appropriate message.
  900.    DO starttherm WITH c_transporting,m.g_filetype
  901.  
  902.    DO allgraphictochar
  903. ELSE
  904.    * Do a partial conversion, unless we're dealing with a label
  905.    IF m.g_filetype = c_label      && We only do complete label conversion
  906.       RETURN
  907.    ENDIF
  908.  
  909.    DO selectobj   && figure out which ones to transport
  910.  
  911.    *  Start the thermometer with the appropriate message.
  912.    DO starttherm WITH c_transporting,m.g_filetype
  913.  
  914.    m.g_mercury = 5
  915.    DO updtherm WITH m.g_mercury
  916.  
  917.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.cRealName))
  918.  
  919.    SELECT (m.g_scrnalias)
  920.  
  921.    IF m.g_snippets
  922.       IF m.g_filetype = c_screen
  923.          DO updatescreen
  924.       ELSE
  925.          DO updatereport
  926.       ENDIF
  927.    ENDIF
  928.    IF m.g_newobjects
  929.       DO newgraphictochar
  930.    ENDIF
  931. ENDIF
  932.  
  933. *
  934. * CharToGraphic - Converts everything, new objects or changed snippets from a character
  935. *      platform to a graphical platform.
  936. *
  937. *!*****************************************************************************
  938. *!
  939. *!      Procedure: CHARTOGRAPHIC
  940. *!
  941. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  942. *!
  943. *!          Calls: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  944. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  945. *!               : STARTTHERM         (procedure in TRANSPRT.PRG)
  946. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  947. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  948. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  949. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  950. *!
  951. *!*****************************************************************************
  952. PROCEDURE chartographic
  953. IF m.g_allobjects
  954.    *  Start the thermometer with the appropriate message.
  955.    DO starttherm WITH c_transporting,m.g_filetype
  956.  
  957.    DO allchartographic
  958. ELSE
  959.    IF m.g_filetype = c_label      && We only do complete label convertsion
  960.       RETURN
  961.    ENDIF
  962.  
  963.    DO selectobj   && figure out which ones to transport
  964.  
  965.    *  Start the thermometer with the appropriate message.
  966.    DO starttherm WITH c_transporting,m.g_filetype
  967.  
  968.    m.g_mercury = 5
  969.    DO updtherm WITH m.g_mercury
  970.  
  971.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.cRealName))
  972.  
  973.    SELECT (m.g_scrnalias)
  974.  
  975.    IF m.g_snippets
  976.       IF m.g_filetype = c_screen
  977.          DO updatescreen
  978.       ELSE
  979.          DO updatereport
  980.       ENDIF
  981.    ENDIF
  982.    IF m.g_newobjects
  983.       DO newchartographic
  984.    ENDIF
  985. ENDIF
  986. *
  987. * GraphicToGraphic - Converts everything, new objects or changed snippets from a graphic
  988. *      platform to another graphical platform.
  989. *
  990. *!*****************************************************************************
  991. *!
  992. *!      Procedure: GRAPHICOGRAPHIC
  993. *!
  994. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  995. *!
  996. *!          Calls: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  997. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  998. *!               : STARTTHERM         (procedure in TRANSPRT.PRG)
  999. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1000. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  1001. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  1002. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1003. *!
  1004. *!*****************************************************************************
  1005. PROCEDURE graphictographic
  1006. IF m.g_allobjects
  1007.    *  Start the thermometer with the appropriate message.
  1008.    DO starttherm WITH c_transporting,m.g_filetype
  1009.  
  1010.    DO allgrphtogrph
  1011. ELSE
  1012.    IF m.g_filetype = c_label      && We only do complete label convertsion
  1013.       RETURN
  1014.    ENDIF
  1015.  
  1016.    DO selectobj   && figure out which ones to transport
  1017.  
  1018.    *  Start the thermometer with the appropriate message.
  1019.    DO starttherm WITH c_transporting,m.g_filetype
  1020.  
  1021.    m.g_mercury = 5
  1022.    DO updtherm WITH m.g_mercury
  1023.  
  1024.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.cRealName))
  1025.  
  1026.    SELECT (m.g_scrnalias)
  1027.  
  1028.    IF m.g_snippets
  1029.       IF m.g_filetype = c_screen
  1030.          DO updatescreen
  1031.       ELSE
  1032.          DO updatereport
  1033.       ENDIF
  1034.    ENDIF
  1035.    IF m.g_newobjects
  1036.       DO newgrphtogrph
  1037.    ENDIF
  1038. ENDIF
  1039.  
  1040. *
  1041. * UpdateScreen - Copy any non-platform specific
  1042. *
  1043. *!*****************************************************************************
  1044. *!
  1045. *!      Procedure: UPDATESCREEN
  1046. *!
  1047. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1048. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1049. *!
  1050. *!          Calls: GETSNIPFLAG()      (function  in TRANSPRT.PRG)
  1051. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1052. *!               : MAPBUTTON()        (function  in TRANSPRT.PRG)
  1053. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1054. *!
  1055. *!           Uses: M.G_SCRNALIAS
  1056. *!
  1057. *!        Indexes: ID                     (tag)
  1058. *!
  1059. *!*****************************************************************************
  1060. PROCEDURE updatescreen
  1061. PRIVATE m.thermstep
  1062.  
  1063. COUNT TO m.thermstep FOR platform = m.g_toplatform
  1064. IF m.g_newobjects
  1065.    m.thermstep = 40/m.thermstep
  1066. ELSE
  1067.    m.thermstep = 80/m.thermstep
  1068. ENDIF
  1069.  
  1070. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1071. SELECT * FROM (m.g_scrnalias) ;
  1072.    WHERE !DELETED() AND platform = m.g_fromplatform ;
  1073.    AND isselected(uniqueid,objtype,objcode) ;
  1074.    INTO CURSOR (m.g_tempalias)
  1075. INDEX ON uniqueid TAG id
  1076.  
  1077. SELECT (m.g_scrnalias)
  1078. SET RELATION TO uniqueid INTO (m.g_tempalias) ADDITIVE
  1079. LOCATE FOR .T.
  1080.  
  1081. SELECT (m.g_scrnalias)
  1082.  
  1083. * Check for flag to transport only code snippets
  1084. m.sniponly = .F.
  1085. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  1086. IF FOUND()
  1087.    m.sniponly = getsnipflag(setupcode)
  1088. ENDIF
  1089.  
  1090. IF !m.sniponly
  1091.    DO updenviron WITH .T.
  1092. ENDIF
  1093.  
  1094. * Update everything else
  1095. SCAN FOR platform = m.g_toplatform AND !DELETED() ;
  1096.       AND (INLIST(objtype,C_OBJTYPELIST) OR objtype = c_otheader)
  1097.    IF &g_tempalias..timestamp > timestamp
  1098.       IF !m.sniponly
  1099.          REPLACE name WITH &g_tempalias..name
  1100.          REPLACE expr WITH &g_tempalias..expr
  1101.          REPLACE STYLE WITH &g_tempalias..style
  1102.          IF INLIST(objtype,c_otradbut,c_ottxtbut)
  1103.             * Don't zap the whole set of buttons if there are just some new ones
  1104.             REPLACE PICTURE WITH mapbutton(&g_tempalias..picture,PICTURE)
  1105.          ELSE
  1106.             REPLACE PICTURE WITH &g_tempalias..picture
  1107.          ENDIF
  1108.          IF objtype <> c_otheader OR m.g_grph2char OR EMPTY(order)
  1109.             * Icon file name is stored in Windows header, "order" field
  1110.             REPLACE ORDER WITH &g_tempalias..order
  1111.          ENDIF
  1112.          REPLACE unique WITH &g_tempalias..unique
  1113.          *REPLACE Environ WITH &g_tempalias..Environ
  1114.          REPLACE boxchar WITH &g_tempalias..boxchar
  1115.          REPLACE fillchar WITH &g_tempalias..fillchar
  1116.          REPLACE TAG WITH &g_tempalias..tag
  1117.          REPLACE tag2 WITH &g_tempalias..tag2
  1118.          REPLACE ruler WITH &g_tempalias..ruler
  1119.          REPLACE rulerlines WITH &g_tempalias..rulerlines
  1120.          REPLACE grid WITH &g_tempalias..grid
  1121.          REPLACE gridv WITH &g_tempalias..gridv
  1122.          REPLACE gridh WITH &g_tempalias..gridh
  1123.          REPLACE FLOAT WITH &g_tempalias..float
  1124.          REPLACE CLOSE WITH &g_tempalias..close
  1125.          REPLACE MINIMIZE WITH &g_tempalias..minimize
  1126.          REPLACE BORDER WITH &g_tempalias..border
  1127.          REPLACE SHADOW WITH &g_tempalias..shadow
  1128.          REPLACE CENTER WITH &g_tempalias..center
  1129.          REPLACE REFRESH WITH &g_tempalias..refresh
  1130.          REPLACE disabled WITH &g_tempalias..disabled
  1131.          REPLACE scrollbar WITH &g_tempalias..scrollbar
  1132.          REPLACE addalias WITH &g_tempalias..addalias
  1133.          REPLACE TAB WITH &g_tempalias..tab
  1134.          REPLACE initialval WITH &g_tempalias..initialval
  1135.          REPLACE initialnum WITH &g_tempalias..initialnum
  1136.          REPLACE spacing WITH &g_tempalias..spacing
  1137.          * Update width if it looks like a text object got longer in Windows
  1138.          IF m.g_grph2char AND objtype = c_ottext
  1139.             REPLACE width WITH MAX(width,LEN(CHRTRANC(expr,'"'+chr(39),'')))
  1140.          ENDIF
  1141.       ENDIF
  1142.       IF objtype = c_otfield  && watch out for SAYs changing to GETs
  1143.          REPLACE objcode WITH &g_tempalias..objcode
  1144.       ENDIF
  1145.       REPLACE lotype WITH &g_tempalias..lotype
  1146.       REPLACE rangelo WITH &g_tempalias..rangelo
  1147.       REPLACE hitype WITH &g_tempalias..hitype
  1148.       REPLACE rangehi WITH &g_tempalias..rangehi
  1149.       REPLACE whentype WITH &g_tempalias..whentype
  1150.       REPLACE WHEN WITH &g_tempalias..when
  1151.       REPLACE validtype WITH &g_tempalias..validtype
  1152.       REPLACE VALID WITH &g_tempalias..valid
  1153.       REPLACE errortype WITH &g_tempalias..errortype
  1154.       REPLACE ERROR WITH &g_tempalias..error
  1155.       REPLACE messtype WITH &g_tempalias..messtype
  1156.       REPLACE MESSAGE WITH &g_tempalias..message
  1157.       REPLACE showtype WITH &g_tempalias..showtype
  1158.       REPLACE SHOW WITH &g_tempalias..show
  1159.       REPLACE activtype WITH &g_tempalias..activtype
  1160.       REPLACE ACTIVATE WITH &g_tempalias..activate
  1161.       REPLACE deacttype WITH &g_tempalias..deacttype
  1162.       REPLACE DEACTIVATE WITH &g_tempalias..deactivate
  1163.       REPLACE proctype WITH &g_tempalias..proctype
  1164.       REPLACE proccode WITH &g_tempalias..proccode
  1165.       REPLACE setuptype WITH &g_tempalias..setuptype
  1166.       REPLACE setupcode WITH &g_tempalias..setupcode
  1167.  
  1168.       REPLACE timestamp WITH &g_tempalias..timestamp
  1169.       REPLACE platform WITH m.g_toplatform
  1170.    ENDIF
  1171.  
  1172.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1173.    DO updtherm WITH m.g_mercury
  1174.  
  1175. ENDSCAN
  1176.  
  1177. SELECT (m.g_tempalias)
  1178. USE
  1179. SELECT (m.g_scrnalias)
  1180.  
  1181. RETURN
  1182.  
  1183. *
  1184. * UpdateReport - Copy any "non-platform specific" information from one platform to another
  1185. *
  1186. *!*****************************************************************************
  1187. *!
  1188. *!      Procedure: UPDATEREPORT
  1189. *!
  1190. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1191. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1192. *!
  1193. *!          Calls: ADJRPTSUPPRESS     (procedure in TRANSPRT.PRG)
  1194. *!               : ADJRPTFLOAT        (procedure in TRANSPRT.PRG)
  1195. *!               : ADJRPTRESET        (procedure in TRANSPRT.PRG)
  1196. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1197. *!
  1198. *!           Uses: M.G_SCRNALIAS
  1199. *!
  1200. *!        Indexes: ID                     (tag)
  1201. *!
  1202. *!*****************************************************************************
  1203. PROCEDURE updatereport
  1204. PRIVATE m.thermstep
  1205.  
  1206. LOCAL cOldCPTrans
  1207. cOldCPTrans = SET("NOCPTRANS")
  1208.  
  1209. COUNT TO m.thermstep FOR platform = m.g_toplatform
  1210. IF m.g_newobjects
  1211.    m.thermstep = 40/m.thermstep
  1212. ELSE
  1213.    m.thermstep = 80/m.thermstep
  1214. ENDIF
  1215.  
  1216. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1217. SELECT * FROM (m.g_scrnalias) ;
  1218.    WHERE platform = m.g_fromplatform AND !DELETED();
  1219.    AND isselected(uniqueid,objtype,objcode) ;
  1220.    INTO CURSOR (m.g_tempalias)
  1221. INDEX ON uniqueid TAG id
  1222.  
  1223. SELECT (m.g_scrnalias)
  1224. SET RELATION TO uniqueid INTO (m.g_tempalias) ADDITIVE
  1225. LOCATE FOR .T.
  1226.  
  1227. SELECT (m.g_scrnalias)
  1228. SET NOCPTRANS TO tag, tag2
  1229. DO updenviron WITH .T.
  1230.  
  1231.  
  1232. SCAN FOR platform = m.g_toplatform AND ;
  1233.       (objtype = c_otheader OR objtype = c_otfield OR objtype = c_otpicture OR ;
  1234.       objtype = c_otrepfld OR objtype = c_otband OR objtype = c_otrepvar OR ;
  1235.       objtype = c_ottext OR objtype = c_otline OR objtype = c_otbox) AND !DELETED()
  1236.    IF &g_tempalias..timestamp > timestamp
  1237.       REPLACE name WITH &g_tempalias..name
  1238.       IF objtype = c_otrepvar AND m.g_grph2char
  1239.          REPLACE name WITH UPPER(name)
  1240.       ENDIF
  1241.       REPLACE expr WITH &g_tempalias..expr
  1242.       REPLACE STYLE WITH &g_tempalias..style
  1243.       REPLACE PICTURE WITH &g_tempalias..picture
  1244.       REPLACE ORDER WITH &g_tempalias..order
  1245.       REPLACE unique WITH &g_tempalias..unique
  1246.       REPLACE ENVIRON WITH &g_tempalias..environ
  1247.       REPLACE boxchar WITH &g_tempalias..boxchar
  1248.       REPLACE fillchar WITH &g_tempalias..fillchar
  1249.       REPLACE TAG WITH &g_tempalias..tag
  1250.       REPLACE tag2 WITH &g_tempalias..tag2
  1251.       REPLACE mode WITH &g_tempalias..mode
  1252.       REPLACE ruler WITH &g_tempalias..ruler
  1253.       REPLACE rulerlines WITH &g_tempalias..rulerlines
  1254.       REPLACE grid WITH &g_tempalias..grid
  1255.       REPLACE gridv WITH &g_tempalias..gridv
  1256.       REPLACE gridh WITH &g_tempalias..gridh
  1257.       REPLACE FLOAT WITH &g_tempalias..float
  1258.       REPLACE STRETCH WITH &g_tempalias..stretch
  1259.       REPLACE stretchtop WITH &g_tempalias..stretchtop
  1260.       REPLACE TOP WITH &g_tempalias..top
  1261.       REPLACE BOTTOM WITH &g_tempalias..bottom
  1262.       REPLACE suptype WITH &g_tempalias..suptype
  1263.       REPLACE suprest WITH &g_tempalias..suprest
  1264.       REPLACE norepeat WITH &g_tempalias..norepeat
  1265.       REPLACE resetrpt WITH &g_tempalias..resetrpt
  1266.       REPLACE pagebreak WITH &g_tempalias..pagebreak
  1267.       REPLACE colbreak WITH &g_tempalias..colbreak
  1268.       REPLACE resetpage WITH &g_tempalias..resetpage
  1269.       REPLACE GENERAL WITH &g_tempalias..general
  1270.       REPLACE spacing WITH &g_tempalias..spacing
  1271.       REPLACE DOUBLE WITH &g_tempalias..double
  1272.       REPLACE swapheader WITH &g_tempalias..swapheader
  1273.       REPLACE swapfooter WITH &g_tempalias..swapfooter
  1274.       REPLACE ejectbefor WITH &g_tempalias..ejectbefor
  1275.       REPLACE ejectafter WITH &g_tempalias..ejectafter
  1276.       REPLACE PLAIN WITH &g_tempalias..plain
  1277.       REPLACE SUMMARY WITH &g_tempalias..summary
  1278.       REPLACE addalias WITH &g_tempalias..addalias
  1279.       REPLACE offset WITH &g_tempalias..offset
  1280.       REPLACE topmargin WITH &g_tempalias..topmargin
  1281.       REPLACE botmargin WITH &g_tempalias..botmargin
  1282.       REPLACE totaltype WITH &g_tempalias..totaltype
  1283.       REPLACE resettotal WITH &g_tempalias..resettotal
  1284.       REPLACE resoid WITH &g_tempalias..resoid
  1285.       REPLACE curpos WITH &g_tempalias..curpos
  1286.       REPLACE supalways WITH &g_tempalias..supalways
  1287.       REPLACE supovflow WITH &g_tempalias..supovflow
  1288.       REPLACE suprpcol WITH &g_tempalias..suprpcol
  1289.       REPLACE supgroup WITH &g_tempalias..supgroup
  1290.       REPLACE supvalchng WITH &g_tempalias..supvalchng
  1291.       REPLACE supexpr WITH &g_tempalias..supexpr
  1292.  
  1293.         *- if possibly transporting 3.0 files (11/14/95 jd)
  1294.         IF TYPE("user") == "M" AND TYPE(g_tempalias + ".user") == "M"
  1295.             REPLACE user WITH &g_tempalias..user
  1296.         ENDIF
  1297.  
  1298.       REPLACE timestamp WITH &g_tempalias..timestamp
  1299.       REPLACE platform WITH m.g_toplatform
  1300.  
  1301.       * Update width if it looks like a text object got longer in Windows
  1302.       IF m.g_grph2char AND objtype = c_ottext
  1303.          REPLACE width WITH MAX(width,LEN(CHRTRANC(expr,'"'+chr(39),'')))
  1304.       ENDIF
  1305.  
  1306.       DO adjrptsuppress
  1307.       DO adjrptfloat
  1308.       IF objtype = c_otrepvar OR (objtype = c_otrepfld AND totaltype > 0)
  1309.          DO adjrptreset
  1310.       ENDIF
  1311.    ENDIF
  1312.  
  1313.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1314.    DO updtherm WITH m.g_mercury
  1315. ENDSCAN
  1316. SET NOCPTRANS TO &cOldCPTrans
  1317.  
  1318. SELECT (m.g_tempalias)
  1319. USE
  1320. SELECT (m.g_scrnalias)
  1321.  
  1322. RETURN
  1323.  
  1324.  
  1325. *!*****************************************************************************
  1326. *!
  1327. *!      Procedure: UPDENVIRON
  1328. *!
  1329. *!*****************************************************************************
  1330. PROCEDURE updenviron
  1331. PARAMETER m.mustexist
  1332. * Update environment records if the user selected environment records for transport
  1333. * and if any of them have been updated.
  1334. IF EnvSelect() AND IsNewerEnv(m.mustexist)
  1335.    * Drop the old environment and put the new one in
  1336.    DELETE FOR IsEnviron(objtype) and platform = m.g_toplatform
  1337.    SCAN FOR platform = m.g_fromplatform AND IsEnviron(Objtype)
  1338.       SCATTER MEMVAR MEMO
  1339.       APPEND BLANK
  1340.       GATHER MEMVAR MEMO
  1341.       REPLACE platform WITH m.g_toplatform
  1342.       IF m.g_grph2char
  1343.          * DOS requires the alias name to be in upper case, while Windows doesn't
  1344.          REPLACE TAG WITH UPPER(TAG)
  1345.          REPLACE tag2 WITH UPPER(tag2)
  1346.       ENDIF
  1347.    ENDSCAN
  1348.    m.g_updenviron = .T.
  1349. ENDIF
  1350.  
  1351. *
  1352. * CONVERTPROJECT - Convert project file from 2.0 to 2.5 format
  1353. *
  1354. *!*****************************************************************************
  1355. *!
  1356. *!      Procedure: CONVERTPROJECT
  1357. *!
  1358. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  1359. *!
  1360. *!*****************************************************************************
  1361. PROCEDURE convertproject
  1362. PRIVATE m.i
  1363.  
  1364. SELECT (m.g_scrnalias)
  1365. ZAP
  1366.  
  1367. SELECT (m.g_20alias)
  1368. SCAN FOR !DELETED()
  1369.    SCATTER MEMVAR MEMO
  1370.    m.wasarranged = arranged
  1371.    RELEASE m.arranged         && to avoid type mismatch at GATHER time
  1372.  
  1373.    SELECT (m.g_scrnalias)
  1374.    APPEND BLANK
  1375.    GATHER MEMVAR MEMO
  1376.    DO CASE
  1377.    CASE type == "H"
  1378.       IF !EMPTY(devinfo)
  1379.          * Adjust developer info to support wider state code
  1380.          REPLACE devinfo WITH STUFF(devinfo,162,0,CHR(0)+CHR(0)+CHR(0))
  1381.          REPLACE devinfo WITH STUFF(devinfo,176,0,REPLICATE(CHR(0),46))
  1382.       ENDIF
  1383.  
  1384.    CASE type == "s"   && must be lowercase S
  1385.       * Adjust for the new method of storing cross-platform arrangement info
  1386.       * (ScrnRow = -999 for centered screens)
  1387.       REPLACE arranged WITH ;
  1388.           PADR(c_dosname,8);
  1389.          +IIF(m.wasarranged,"T","F");
  1390.          +IIF(m.scrnrow=-999,"T","F");
  1391.          +PADL(LTRIM(STR(m.scrnrow,4)),8) ;
  1392.          +PADL(LTRIM(STR(m.scrncol,4)),8) ;
  1393.          +PADR(c_winname,8);
  1394.          +IIF(m.wasarranged,"T","F");
  1395.          +IIF(m.scrnrow=-999,"T","F");
  1396.          +PADL(LTRIM(STR(m.scrnrow,4)),8) ;
  1397.          +PADL(LTRIM(STR(m.scrncol,4)),8) ;
  1398.          +PADR(c_macname,8);
  1399.          +IIF(m.wasarranged,"T","F");
  1400.          +IIF(m.scrnrow=-999,"T","F");
  1401.          +PADL(LTRIM(STR(m.scrnrow,4)),8) ;
  1402.          +PADL(LTRIM(STR(m.scrncol,4)),8)
  1403.    ENDCASE
  1404.  
  1405.    * Adjust the symbol table
  1406.    IF !EMPTY(symbols)
  1407.       FOR i = 1 TO INT((LEN(symbols)-4)/14)
  1408.          * Format of a 2.0 symbol table is
  1409.          *   4 bytes of header information
  1410.          *   n occurrences of this structure:
  1411.          *      TEXT symName[11]
  1412.          *      TEXT symType
  1413.          *      TEXT flags[2]
  1414.          * Format of a 2.5 symbol table is the same, except symName is now 13 bytes long
  1415.          REPLACE symbols WITH STUFF(symbols,(m.i-1)*16+15,0,CHR(0)+CHR(0))
  1416.          REPLACE ckval WITH VAL(sys(2007,symbols))
  1417.       ENDFOR
  1418.    ENDIF
  1419.  
  1420.    * Blank out the timestamp
  1421.    REPLACE timestamp WITH 0
  1422. ENDSCAN
  1423.  
  1424. *
  1425. * NewCharToGraphic - Take any new objects from the character platform and copy them
  1426. *      to the graphical platform.
  1427. *
  1428. *!*****************************************************************************
  1429. *!
  1430. *!      Procedure: NEWCHARTOGRAPHIC
  1431. *!
  1432. *!      Called by: CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1433. *!
  1434. *!          Calls: GETWINDFONT        (procedure in TRANSPRT.PRG)
  1435. *!               : NEWBANDS           (procedure in TRANSPRT.PRG)
  1436. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  1437. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1438. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  1439. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  1440. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1441. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  1442. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  1443. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1444. *!
  1445. *!           Uses: M.G_SCRNALIAS
  1446. *!
  1447. *!*****************************************************************************
  1448. PROCEDURE newchartographic
  1449. PRIVATE m.thermstep, m.bandcount
  1450.  
  1451. m.g_newobjmode = .T.
  1452. SELECT (m.g_scrnalias)
  1453. SET ORDER TO
  1454.  
  1455. * Get the default font for the window in the "to" platform
  1456. IF m.g_char2grph
  1457.    DO getwindfont
  1458. ENDIF
  1459.  
  1460. * Update the environment if it is new
  1461. DO updenviron WITH .F.
  1462.  
  1463. * Remember the window default font
  1464. SELECT (m.g_scrnalias)
  1465. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  1466. IF FOUND()
  1467.    m.wfontface  = fontface
  1468.    m.wfontsize  = fontsize
  1469.    m.wfontstyle = fontstyle
  1470. ELSE
  1471.    m.wfontface  = m.g_dfltfface
  1472.    m.wfontsize  = m.g_dfltfsize
  1473.    m.wfontstyle = m.g_dfltfstyle
  1474. ENDIF
  1475.  
  1476. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1477. SELECT * FROM (m.g_scrnalias) ;
  1478.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1479.    isselected(uniqueid,objtype,objcode) AND ;
  1480.    uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  1481.    WHERE platform = m.g_toplatform) ;
  1482.    INTO CURSOR (m.g_tempalias)
  1483.  
  1484. IF m.g_snippets
  1485.    m.thermstep = 35/_TALLY
  1486. ELSE
  1487.    m.thermstep = 70/_TALLY
  1488. ENDIF
  1489.  
  1490. IF m.g_filetype = c_report
  1491.    DO newbands
  1492.  
  1493.    * We need to know where bands start and where they end in
  1494.    * both platforms.
  1495.    SELECT (m.g_scrnalias)
  1496.    COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  1497.    DIMENSION bands[m.bandCount,4]
  1498.    m.bandcount = bandinfo()
  1499.    SELECT (m.g_tempalias)
  1500. ENDIF
  1501.  
  1502. m.rightmost = 0
  1503. m.bottommost = 0
  1504.  
  1505. SCAN
  1506.    IF INLIST(objtype,C_OBJTYPELIST)
  1507.       SCATTER MEMVAR MEMO
  1508.       SELECT (m.g_scrnalias)
  1509.       APPEND BLANK
  1510.       GATHER MEMVAR MEMO
  1511.  
  1512.       REPLACE platform WITH m.g_toplatform
  1513.  
  1514.       DO platformdefaults WITH 0
  1515.       DO fillininfo
  1516.  
  1517.       DO CASE
  1518.       CASE INLIST(objtype,c_otbox, c_otline)
  1519.          DO adjbox WITH c_adjbox
  1520.       ENDCASE
  1521.  
  1522.       IF m.g_filetype = c_report
  1523.          DO rptobjconvert WITH m.bandcount
  1524.       ELSE
  1525.          REPLACE vpos WITH findlikevpos(vpos)
  1526.          REPLACE hpos WITH findlikehpos(hpos)
  1527.  
  1528.          m.rightmost = MAX(m.rightmost, hpos + width ;
  1529.           * FONTMETRIC(6,fontface,fontsize,num2style(fontstyle)) ;
  1530.           / FONTMETRIC(6,m.wfontface,m.wfontsize,num2style(m.wfontstyle)))
  1531.          m.bottommost = MAX(m.bottommost, vpos + height ;
  1532.           * FONTMETRIC(1,fontface,fontsize,num2style(fontstyle)) ;
  1533.           / FONTMETRIC(1,m.wfontface,m.wfontsize,num2style(m.wfontstyle)))
  1534.       ENDIF
  1535.    ENDIF
  1536.  
  1537.    SELECT (m.g_tempalias)
  1538.  
  1539.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1540.    DO updtherm WITH m.g_mercury
  1541. ENDSCAN
  1542.  
  1543. SELECT (m.g_tempalias)
  1544. USE
  1545. SELECT (m.g_scrnalias)
  1546. * Update screen width/height if necessary to hold the new objects
  1547. IF m.g_filetype = c_screen
  1548.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  1549.    IF FOUND()
  1550.       * If the screen/report isn't big enough to hold the widest/tallest object,
  1551.       * resize it.
  1552.       IF width < m.rightmost
  1553.          REPLACE width WITH m.rightmost + IIF(m.g_filetype = c_screen,2,2000)
  1554.       ENDIF
  1555.       IF height < m.bottommost AND m.g_filetype = c_screen
  1556.          REPLACE height WITH m.bottommost + IIF(m.g_filetype = c_screen,1,2000)
  1557.       ENDIF
  1558.    ENDIF
  1559. ENDIF
  1560. RETURN
  1561.  
  1562. *
  1563. * NewGraphicToChar - Take any new objects from the graphic platform and copy them
  1564. *      to the character platform.
  1565. *
  1566. *!*****************************************************************************
  1567. *!
  1568. *!      Procedure: NEWGRAPHICTOCHAR
  1569. *!
  1570. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1571. *!
  1572. *!          Calls: NEWBANDS           (procedure in TRANSPRT.PRG)
  1573. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  1574. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1575. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  1576. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  1577. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  1578. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1579. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  1580. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  1581. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1582. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  1583. *!
  1584. *!           Uses: M.G_SCRNALIAS
  1585. *!
  1586. *!*****************************************************************************
  1587. PROCEDURE newgraphictochar
  1588. PRIVATE m.thermstep, m.bandcount
  1589.  
  1590. m.g_newobjmode = .T.
  1591. SELECT (m.g_scrnalias)
  1592. SET ORDER TO
  1593.  
  1594. * Update the environment if it is new
  1595. DO updenviron WITH .F.
  1596.  
  1597. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1598. *
  1599. * Get a cursor containing the records in the "to" platform that do not have
  1600. * counterparts in the "from" platform.  Exclude Windows report column headers
  1601. * and column footers (objtype = 9, objcode = 2 or 6) since they have no DOS analogs.
  1602. * Exclude boxes that are filled black.  They are probably used for shadow effects.
  1603. *
  1604. SELECT * FROM (m.g_scrnalias) ;
  1605.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1606.    !(objtype = c_otband AND INLIST(objcode,2,6)) AND ;
  1607.    isselected(uniqueid,objtype,objcode) AND ;
  1608.    !blackbox(objtype,fillred,fillblue,fillgreen,fillpat) AND ;
  1609.    uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  1610.    WHERE platform = m.g_toplatform) ;
  1611.    INTO CURSOR (m.g_tempalias)
  1612.  
  1613. IF m.g_snippets
  1614.    m.thermstep = 35/_TALLY
  1615. ELSE
  1616.    m.thermstep = 70/_TALLY
  1617. ENDIF
  1618.  
  1619. IF m.g_filetype = c_report
  1620.    DO newbands
  1621.  
  1622.    * We need to know where bands start and where they end in
  1623.    * both platforms.
  1624.    SELECT (m.g_scrnalias)
  1625.    COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  1626.    DIMENSION bands[m.bandCount,4]
  1627.    m.bandcount = bandinfo()
  1628.    SELECT (m.g_tempalias)
  1629. ENDIF
  1630.  
  1631. LOCATE FOR .T.
  1632. DO WHILE !EOF()
  1633.    IF INLIST(objtype,C_OBJTYPELIST) AND objtype <> c_otpicture
  1634.       SCATTER MEMVAR MEMO
  1635.       SELECT (m.g_scrnalias)
  1636.       APPEND BLANK
  1637.       GATHER MEMVAR MEMO
  1638.  
  1639.       REPLACE platform WITH m.g_toplatform
  1640.  
  1641.       DO platformdefaults WITH 0
  1642.       DO fillininfo
  1643.  
  1644.       IF m.g_filetype = c_screen
  1645.          DO adjheightandwidth
  1646.       ELSE
  1647.         DO rptobjconvert WITH m.bandcount
  1648.       ENDIF
  1649.  
  1650.       REPLACE vpos WITH findlikevpos(vpos)
  1651.       REPLACE hpos WITH findlikehpos(hpos)
  1652.    ENDIF
  1653.  
  1654.    SELECT (m.g_tempalias)
  1655.    SKIP
  1656.  
  1657.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1658.    DO updtherm WITH m.g_mercury
  1659. ENDDO
  1660.  
  1661. SELECT (m.g_tempalias)
  1662. USE
  1663. SELECT (m.g_scrnalias)
  1664.  
  1665. DO makecharfit
  1666.  
  1667. RETURN
  1668.  
  1669. *
  1670. * NewGrphToGrph - Take any new objects from the graphic platform and copy them
  1671. *      to the other graphical platform.
  1672. *
  1673. *!*****************************************************************************
  1674. *!
  1675. *!      Procedure: NEWGRPHTOGRPH
  1676. *!
  1677. *!          Calls: NEWBANDS           (procedure in TRANSPRT.PRG)
  1678. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  1679. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1680. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  1681. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  1682. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  1683. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1684. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  1685. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  1686. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1687. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  1688. *!
  1689. *!           Uses: M.G_SCRNALIAS
  1690. *!
  1691. *!*****************************************************************************
  1692. PROCEDURE newgrphtogrph
  1693. PRIVATE m.thermstep, m.bandcount
  1694.  
  1695. m.g_newobjmode = .T.
  1696.  
  1697. m.g_bandfudge = 0
  1698.  
  1699. SELECT (m.g_scrnalias)
  1700. SET ORDER TO
  1701.  
  1702. * Update the environment if it is new
  1703. DO updenviron WITH .F.
  1704.  
  1705. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1706. *
  1707. * Get a cursor containing the records in the "to" platform that do not have
  1708. * counterparts in the "from" platform.
  1709. *
  1710. SELECT * FROM (m.g_scrnalias) ;
  1711.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1712.    isselected(uniqueid,objtype,objcode) AND ;
  1713.    uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  1714.    WHERE platform = m.g_toplatform) ;
  1715.    INTO CURSOR (m.g_tempalias)
  1716.  
  1717. IF m.g_snippets
  1718.    m.thermstep = 35/_TALLY
  1719. ELSE
  1720.    m.thermstep = 70/_TALLY
  1721. ENDIF
  1722.  
  1723. IF m.g_filetype = c_report
  1724.  
  1725.    DO newbands
  1726.  
  1727.    * We need to know where bands start and where they end in
  1728.    * both platforms.
  1729.    SELECT (m.g_scrnalias)
  1730.    COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  1731.    DIMENSION bands[m.bandCount,4]
  1732.    m.bandcount = bandinfo()
  1733.    SELECT (m.g_tempalias)
  1734. ENDIF
  1735.  
  1736. LOCATE FOR .T.
  1737. DO WHILE !EOF()
  1738.    IF INLIST(objtype,C_OBJTYPELIST) AND objtype <> c_otpicture
  1739.       SCATTER MEMVAR MEMO
  1740.       SELECT (m.g_scrnalias)
  1741.       APPEND BLANK
  1742.       GATHER MEMVAR MEMO
  1743.  
  1744.       REPLACE platform WITH m.g_toplatform
  1745.  
  1746.       DO platformdefaults WITH 0
  1747.       DO fillininfo
  1748.  
  1749.       IF m.g_filetype = c_screen
  1750.          DO adjheightandwidth
  1751.       ELSE
  1752.         DO rptobjconvert WITH m.bandcount
  1753.       ENDIF
  1754.  
  1755.       REPLACE vpos WITH findlikevpos(vpos)
  1756.       REPLACE hpos WITH findlikehpos(hpos)
  1757.    ENDIF
  1758.  
  1759.    SELECT (m.g_tempalias)
  1760.    SKIP
  1761.  
  1762.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1763.    DO updtherm WITH m.g_mercury
  1764. ENDDO
  1765.  
  1766. SELECT (m.g_tempalias)
  1767. USE
  1768. SELECT (m.g_scrnalias)
  1769.  
  1770. RETURN
  1771.  
  1772. *
  1773. * NewBands - Add any new band records.
  1774. *
  1775. *!*****************************************************************************
  1776. *!
  1777. *!      Procedure: NEWBANDS
  1778. *!
  1779. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1780. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  1781. *!
  1782. *!          Calls: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1783. *!               : BANDPOS()          (function  in TRANSPRT.PRG)
  1784. *!
  1785. *!*****************************************************************************
  1786. PROCEDURE newbands
  1787. PRIVATE m.prevband, m.bandstart, m.bandheight
  1788. * We need to have the groups in order to do report objects, so we do them seperately.
  1789.  
  1790. SCAN FOR objtype = c_otband
  1791.    SCATTER MEMVAR MEMO
  1792.    SELECT (m.g_scrnalias)
  1793.    LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.uniqueid
  1794.    SKIP -1
  1795.    m.prevband = uniqueid
  1796.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.prevband
  1797.    INSERT BLANK
  1798.    GATHER MEMVAR MEMO
  1799.    REPLACE platform WITH m.g_toplatform
  1800.  
  1801.    DO rptobjconvert WITH 0
  1802.  
  1803.    DO CASE
  1804.    CASE m.g_char2grph
  1805.       m.bandheight = height + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  1806.    CASE m.g_grph2char
  1807.       m.bandheight = 0
  1808.    CASE m.g_grph2grph
  1809.       m.bandheight = height + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  1810.         IF _MAC AND objcode >= 4
  1811.            m.bandheight = m.bandheight + (1/m.g_pixelsize)*10000
  1812.         ENDIF
  1813.    ENDCASE
  1814.    m.bandstart = bandpos(m.uniqueid, m.g_toplatform)
  1815.  
  1816.     IF m.g_grph2grph
  1817.        * Because of the bandfudge adjustment, we need to allow some leeway on
  1818.        * the staring point of the band.  Allow 1/2 pixel.
  1819.        m.bandstart = m.bandstart - ((1/2) / m.g_pixelsize) * 10000
  1820.     ENDIF
  1821.  
  1822.    * Move all the lower bands down by the size of the one we just inserted.
  1823.    REPLACE ALL vpos WITH vpos + m.bandheight ;
  1824.       FOR platform = m.g_toplatform AND ;
  1825.       (objtype = c_otline OR objtype = c_otbox OR ;
  1826.       objtype = c_ottext OR objtype = c_otrepfld) AND ;
  1827.       vpos >= m.bandstart
  1828.    SELECT (m.g_tempalias)
  1829. ENDSCAN
  1830.  
  1831. *
  1832. * AllGraphicToChar - Convert from a graphic platform to a character platform assuming
  1833. *      that no records exist for the target platform.
  1834. *
  1835. *!*****************************************************************************
  1836. *!
  1837. *!      Procedure: ALLGRAPHICTOCHAR
  1838. *!
  1839. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1840. *!
  1841. *!          Calls: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  1842. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  1843. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  1844. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  1845. *!               : MERGELABELOBJECTS  (procedure in TRANSPRT.PRG)
  1846. *!               : LINESBETWEEN       (procedure in TRANSPRT.PRG)
  1847. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  1848. *!               : SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  1849. *!
  1850. *!           Uses: M.G_SCRNALIAS
  1851. *!
  1852. *!*****************************************************************************
  1853. PROCEDURE allgraphictochar
  1854. PRIVATE m.objindex
  1855.  
  1856. DO allenvirons
  1857.  
  1858. *
  1859. * Create a cursor with all the objects we have left to add.
  1860. *
  1861. m.g_fromobjonlyalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1862. SELECT *, RECNO() AS recnum FROM (m.g_scrnalias) ;
  1863.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1864.    objtype <> c_otrel AND objtype <> c_otworkar AND objtype <> c_otindex AND ;
  1865.    objtype <> c_otheader AND objtype <> c_otgroup AND ;
  1866.    objtype <> c_otpicture AND ;
  1867.    !blackbox(objtype,fillred,fillblue,fillgreen,fillpat) AND ;
  1868.    !(m.g_filetype = c_label AND objtype = c_ot20label) AND ;
  1869.    !(objtype = c_ot20lbxobj AND EMPTY(expr)) AND;
  1870.    oktransport(comment) ;
  1871.    INTO CURSOR (m.g_fromobjonlyalias)
  1872. m.objindex = _TALLY
  1873.  
  1874. DO allothers WITH 80
  1875. DO allgroups WITH 10
  1876.  
  1877. DO CASE
  1878. CASE m.g_filetype = c_label
  1879.    ** Trim any records the character platforms won't deal with.
  1880.    DELETE FOR platform = m.g_toplatform AND ;
  1881.       ((objtype = c_otband AND objcode != 4) OR ;
  1882.       objtype = c_otrepvar OR objtype = c_otpicture OR ;
  1883.       objtype = c_otline OR objtype = c_otbox)
  1884.    DO rptconvert
  1885.    DO mergelabelobjects
  1886.    DO linesbetween
  1887.  
  1888. CASE m.g_filetype = c_report
  1889.    ** Trim any records the character platforms won't deal with.
  1890.    DELETE FOR platform = m.g_toplatform AND (objtype = c_otpicture)
  1891.    DO rptconvert
  1892.    DO makecharfit
  1893.    DO suppressblanklines
  1894.  
  1895. CASE m.g_filetype = c_screen
  1896.    DO makecharfit
  1897. ENDCASE
  1898.  
  1899. SELECT (m.g_fromobjonlyalias)
  1900. USE
  1901. SELECT (m.g_scrnalias)
  1902.  
  1903. RETURN
  1904.  
  1905. *
  1906. * AllCharToGraphic - Convert from a character platform to a graphic platform assuming
  1907. *      that no records exist for the target platform.
  1908. *
  1909. *!*****************************************************************************
  1910. *!
  1911. *!      Procedure: ALLCHARTOGRAPHIC
  1912. *!
  1913. *!      Called by: CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1914. *!
  1915. *!          Calls: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  1916. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  1917. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  1918. *!               : CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  1919. *!               : ADJITEMSINBOXES    (procedure in TRANSPRT.PRG)
  1920. *!               : ADJINVBTNS         (procedure in TRANSPRT.PRG)
  1921. *!               : JOINLINES          (procedure in TRANSPRT.PRG)
  1922. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  1923. *!               : SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  1924. *!               : ADDGRAPHICALLABELGR(procedure in TRANSPRT.PRG)
  1925. *!               : LABELBANDS         (procedure in TRANSPRT.PRG)
  1926. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  1927. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1928. *!               : num2style()        (function  in TRANSPRT.PRG)
  1929. *!               : STRETCHLINESTOBORDE(procedure in TRANSPRT.PRG)
  1930. *!
  1931. *!           Uses: M.G_SCRNALIAS
  1932. *!
  1933. *!*****************************************************************************
  1934. PROCEDURE allchartographic
  1935. PRIVATE m.objindex
  1936.  
  1937. * Make equivalent screen/report records for the new platform.
  1938. DO allenvirons
  1939.  
  1940. m.g_fromobjonlyalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1941. SELECT *, RECNO() AS recnum FROM (m.g_scrnalias) ;
  1942.    WHERE !DELETED() AND platform = m.g_fromplatform AND objtype <> c_otrel AND ;
  1943.    objtype <> c_otworkar AND objtype <> c_otindex AND ;
  1944.    objtype <> c_otheader AND objtype <> c_otgroup AND ;
  1945.    !(m.g_filetype = c_label AND objtype = c_ot20label) AND ;
  1946.    !(objtype = c_ot20lbxobj AND EMPTY(expr)) AND;
  1947.    oktransport(comment) ;
  1948.    INTO CURSOR (m.g_fromobjonlyalias)
  1949.  
  1950. m.objindex = _TALLY
  1951. IF _TALLY = 0
  1952.    SELECT (m.g_fromobjonlyalias)
  1953.    USE
  1954.    SELECT (m.g_scrnalias)
  1955.    RETURN
  1956. ENDIF
  1957.  
  1958. DIMENSION objectpos[m.objindex, 9]
  1959.  
  1960. DO allothers WITH 25
  1961. DO allgroups WITH 5
  1962.  
  1963. * Attempt to adjust the position of objects to reflect the position
  1964. * in the previous platform.
  1965.  
  1966. DO CASE
  1967. CASE m.g_filetype = c_screen
  1968.    DO calcwindowdimensions
  1969.    DO adjitemsinboxes
  1970.    DO adjinvbtns
  1971.    *- set this relationship off, before SETting ORDER in the child table
  1972.    SELECT (m.g_fromobjonlyalias)
  1973.    SET RELATION OFF INTO (m.g_scrnalias)
  1974.    SELECT (m.g_scrnalias)
  1975.    SET ORDER TO
  1976.  
  1977.    DO joinlines
  1978.  
  1979. CASE m.g_filetype = c_report
  1980.    DO rptconvert
  1981.    DO joinlines
  1982.    DO suppressblanklines
  1983.  
  1984. CASE m.g_filetype = c_label
  1985.    DO addgraphicallabelgroups
  1986.    DO labelbands
  1987.    DO labellines
  1988. ENDCASE
  1989.  
  1990. m.g_mercury = MIN(m.g_mercury + 5, 95)
  1991. DO updtherm WITH m.g_mercury
  1992.  
  1993. IF m.g_filetype = c_screen
  1994.    IF m.g_allobjects
  1995.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader AND STYLE != 0
  1996.       IF FOUND()
  1997.          IF m.g_windheight - g_lastobjectline[1] - 3 = 0
  1998.             m.adjustment = .5
  1999.          ELSE
  2000.             m.adjustment = m.g_windheight - g_lastobjectline[1] - 3
  2001.          ENDIF
  2002.  
  2003.          IF m.adjustment < 0
  2004.             m.adjustment = m.adjustment + 1.5
  2005.          ENDIF
  2006.  
  2007.          IF m.adjustment > 0
  2008.             REPLACE height WITH g_lastobjectline[2] + ;
  2009.                m.adjustment * (FONTMETRIC(1) / ;
  2010.                FONTMETRIC(1,fontface, fontsize, num2style(fontstyle)))
  2011.          ELSE
  2012.             REPLACE height WITH g_lastobjectline[2] + 1
  2013.          ENDIF
  2014.       ENDIF
  2015.       DO stretchlinestoborders
  2016.    ENDIF
  2017. ENDIF
  2018.  
  2019. m.g_mercury = MIN(m.g_mercury + 5, 95)
  2020. DO updtherm WITH m.g_mercury
  2021.  
  2022. SELECT (m.g_fromobjonlyalias)
  2023. USE
  2024. SELECT (m.g_scrnalias)
  2025.  
  2026. *
  2027. * AllGrphToGrph - Convert from a graphic platform to another graphic platform assuming
  2028. *      that no records exist for the target platform.
  2029. *
  2030. *!*****************************************************************************
  2031. *!
  2032. *!      Procedure: ALLGRPHTOGRPH
  2033. *!
  2034. *!          Calls: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  2035. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  2036. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  2037. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  2038. *!               : MERGELABELOBJECTS  (procedure in TRANSPRT.PRG)
  2039. *!               : LINESBETWEEN       (procedure in TRANSPRT.PRG)
  2040. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  2041. *!               : SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  2042. *!
  2043. *!           Uses: M.G_SCRNALIAS
  2044. *!
  2045. *!*****************************************************************************
  2046. PROCEDURE allgrphtogrph
  2047. PRIVATE m.objindex
  2048.  
  2049. DO allenvirons
  2050.  
  2051. *
  2052. * Create a cursor with all the objects we have left to add.
  2053. *
  2054. m.g_fromobjonlyalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  2055. SELECT *, RECNO() AS recnum FROM (m.g_scrnalias) ;
  2056.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  2057.    objtype <> c_otrel AND objtype <> c_otworkar AND objtype <> c_otindex AND ;
  2058.    objtype <> c_otheader AND objtype <> c_otgroup AND ;
  2059.    !(m.g_filetype = c_label AND objtype = c_ot20label) AND ;
  2060.    !(objtype = c_ot20lbxobj AND EMPTY(expr)) AND;
  2061.    oktransport(comment) ;
  2062.    INTO CURSOR (m.g_fromobjonlyalias)
  2063. m.objindex = _TALLY
  2064.  
  2065. DO allothers WITH 80
  2066. DO allgroups WITH 10
  2067.  
  2068. DO CASE
  2069. CASE m.g_filetype = c_label
  2070.    DO rptconvert
  2071.    DO mergelabelobjects
  2072.    DO linesbetween
  2073.  
  2074. CASE m.g_filetype = c_report
  2075.    DO rptconvert
  2076.  
  2077. CASE m.g_filetype = c_screen
  2078.    *DO makecharfit
  2079. ENDCASE
  2080.  
  2081. SELECT (m.g_fromobjonlyalias)
  2082. USE
  2083. SELECT (m.g_scrnalias)
  2084.  
  2085. RETURN
  2086.  
  2087.  
  2088. *
  2089. * cvrt102FRX - Converts a DOS 1.02 report to DOS 2.5 format
  2090. *
  2091. *!*****************************************************************************
  2092. *!
  2093. *!       Function: CVRT102FRX
  2094. *!
  2095. *!      Called by: TRANSPRT.PRG
  2096. *!
  2097. *!          Calls: DOCREATE           (procedure in TRANSPRT.PRG)
  2098. *!               : FORCEEXT()         (function  in TRANSPRT.PRG)
  2099. *!
  2100. *!*****************************************************************************
  2101. FUNCTION cvrt102frx
  2102. * Converts FoxPro 1.02 DOS report to FoxPro 2.5 DOS report
  2103. PARAMETER m.fname102, m.ftype
  2104. PRIVATE m.bakname, m.in_area
  2105.  
  2106. m.in_area = SELECT()
  2107. SELECT 0
  2108. * Create a database structure matching the tab delimited format
  2109. *  of a 1.02 report file.
  2110. CREATE CURSOR old ( ;
  2111.    objtype N(10,0), ;
  2112.    content N(10,0), ;
  2113.    fldcontent C(254), ;
  2114.    frmcontent C(254), ;
  2115.    vertpos N(10,0), ;
  2116.    horzpos N(10,0), ;
  2117.    height N(10,0), ;
  2118.    WIDTH N(10,0), ;
  2119.    FONT N(10,0), ;
  2120.    fontsize N(10,0), ;
  2121.    STYLE N(10,0), ;
  2122.    penred N(10,0), ;
  2123.    pengreen N(10,0), ;
  2124.    penblue N(10,0), ;
  2125.    fillred N(10,0), ;
  2126.    fillgreen N(10,0), ;
  2127.    fillblue N(10,0), ;
  2128.    PICTURE C(254), ;
  2129.    rangeup N(10,0), ;
  2130.    rangelow N(10,0), ;
  2131.    VALID N(10,0), ;
  2132.    initc N(10,0), ;
  2133.    calcexp N(10,0) ;
  2134.    )
  2135.  
  2136. * Replace quote marks with \" so that APPEND won't strip them out.  They are our only
  2137. * way of distinguishing quoted text from, say, field names.
  2138. m.fpin  = fopen(m.fname102,2)   && open for read access
  2139. m.outname = forceext(m.fname102,"TMP")
  2140. m.fpout = fcreate(m.outname)
  2141.  
  2142. IF m.fpin > 0 AND m.fpout > 0
  2143.    DO WHILE !FEOF(m.fpin)
  2144.       m.buf = fgets(m.fpin)
  2145.       m.buf = STRTRAN(m.buf,'"','\+')
  2146.       =fputs(m.fpout,m.buf)
  2147.    ENDDO
  2148.    =fclose(m.fpin)
  2149.    =fclose(m.fpout)
  2150.  
  2151.    APPEND FROM (m.outname) TYPE DELIMITED WITH TAB
  2152.  
  2153.    * Drop the temporary output file
  2154.    IF FILE(m.outname)
  2155.       DELETE FILE (m.outname)
  2156.    ENDIF
  2157.  
  2158.    * Replace quote markers with quotes in the character fields
  2159.    REPLACE ALL fldcontent WITH STRTRAN(fldcontent,'\+','"'), ;
  2160.                frmcontent WITH STRTRAN(frmcontent,'\+','"'), ;
  2161.                picture    WITH STRTRAN(picture,   '\+','"')  ;
  2162.       FOR objtype = 17
  2163.    * Strip quotes from other object types, such as quoted strings.
  2164.    REPLACE ALL fldcontent WITH STRTRAN(fldcontent,'\+',''), ;
  2165.                frmcontent WITH STRTRAN(frmcontent,'\+',''), ;
  2166.                picture    WITH STRTRAN(picture,   '\+','')  ;
  2167.       FOR objtype <> 17
  2168.  
  2169. ELSE
  2170.    APPEND FROM (m.fname102) TYPE DELIMITED WITH TAB
  2171. ENDIF
  2172.  
  2173. * Create an empty 2.5 report file
  2174. DO docreate WITH "new", c_report
  2175.  
  2176. SELECT old
  2177. SCAN
  2178.    DO CASE
  2179.    CASE objtype = 1  && report record
  2180.       SELECT new
  2181.       APPEND BLANK
  2182.       SELECT old
  2183.       REPLACE new.platform WITH c_dosname
  2184.       REPLACE new.objtype WITH 1
  2185.       REPLACE new.objcode WITH c_25frx
  2186.       REPLACE new.topmargin WITH old.vertpos
  2187.       REPLACE new.botmargin WITH old.horzpos
  2188.       REPLACE new.height WITH old.height
  2189.       REPLACE new.width WITH old.width
  2190.       REPLACE new.offset WITH old.fontsize
  2191.       IF (old.initc > 0)
  2192.          REPLACE new.environ WITH .T.
  2193.       ENDIF
  2194.       IF (old.calcexp = 1 OR old.calcexp = 3)
  2195.          REPLACE new.ejectbefor WITH .T.
  2196.       ENDIF
  2197.       IF (old.calcexp = 2 OR old.calcexp = 3)
  2198.          REPLACE new.ejectafter WITH .T.
  2199.       ENDIF
  2200.  
  2201.    CASE objtype = 5  && text record
  2202.       SELECT new
  2203.       APPEND BLANK
  2204.       SELECT old
  2205.       REPLACE new.platform WITH c_dosname
  2206.       REPLACE new.objtype WITH 5
  2207.       REPLACE new.vpos WITH old.vertpos
  2208.       REPLACE new.hpos WITH old.horzpos
  2209.       REPLACE new.height WITH 1
  2210.       REPLACE new.width WITH old.width
  2211.       IF (old.rangelow > 0)
  2212.          REPLACE new.float WITH .T.
  2213.       ENDIF
  2214.       REPLACE new.expr WITH '"' + CPTRANS(m.g_tocodepage,m.g_fromcodepage,ALLTRIM(old.fldcontent)) + '"'
  2215.  
  2216.    CASE objtype = 7 && box record
  2217.       SELECT new
  2218.       APPEND BLANK
  2219.       SELECT old
  2220.       REPLACE new.platform WITH c_dosname
  2221.       REPLACE new.objtype WITH 7
  2222.       REPLACE new.vpos WITH old.vertpos
  2223.       REPLACE new.hpos WITH old.horzpos
  2224.       REPLACE new.height WITH old.height
  2225.       REPLACE new.width WITH old.width
  2226.       REPLACE new.objcode WITH old.content + 4
  2227.       IF (old.rangelow > 0)
  2228.          REPLACE new.float WITH .T.
  2229.       ENDIF
  2230.       IF (old.fontsize > 0)
  2231.          REPLACE new.boxchar WITH CHR(old.fontsize / 256)
  2232.       ENDIF
  2233.  
  2234.    CASE objtype = 17 && field record
  2235.       SELECT new
  2236.       APPEND BLANK
  2237.       SELECT old
  2238.       REPLACE new.platform WITH c_dosname
  2239.       REPLACE new.objtype WITH 8
  2240.       REPLACE new.vpos WITH old.vertpos
  2241.       REPLACE new.hpos WITH old.horzpos
  2242.       REPLACE new.height WITH 1
  2243.       REPLACE new.width WITH old.width
  2244.       REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,TRIM(old.fldcontent))
  2245.       IF !EMPTY(old.picture)
  2246.          REPLACE new.picture WITH '"' + CPTRANS(m.g_tocodepage,m.g_fromcodepage,ALLTRIM(old.picture)) + '"'
  2247.       ENDIF
  2248.       REPLACE new.totaltype WITH old.valid
  2249.       REPLACE new.resettotal WITH old.initc
  2250.       IF (old.rangeup > 0)
  2251.          REPLACE new.norepeat WITH .T.
  2252.       ENDIF
  2253.  
  2254.       IF (old.rangelow > 1)
  2255.          WRAP = MAX(old.rangelow - 3, 0)
  2256.       ELSE
  2257.          WRAP = old.rangelow
  2258.       ENDIF
  2259.  
  2260.       IF (WRAP > 0)
  2261.          REPLACE new.stretch WITH .T.
  2262.       ENDIF
  2263.  
  2264.       IF (old.rangelow = 3 OR old.rangelow = 4)
  2265.          REPLACE new.float WITH .T.
  2266.       ENDIF
  2267.  
  2268.       REPLACE new.fillchar WITH ALLTRIM(old.frmcontent)
  2269.  
  2270.    CASE objtype = 18 && band record
  2271.       SELECT new
  2272.       APPEND BLANK
  2273.       SELECT old
  2274.       REPLACE new.platform WITH c_dosname
  2275.       REPLACE new.objtype WITH 9
  2276.       REPLACE new.objcode WITH old.content
  2277.       REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,old.fldcontent)
  2278.       REPLACE new.height WITH old.height
  2279.       IF (old.vertpos > 0)
  2280.          REPLACE new.pagebreak WITH .T.
  2281.       ENDIF
  2282.       IF (old.fontsize > 0)
  2283.          REPLACE new.swapheader WITH .T.
  2284.       ENDIF
  2285.       IF (old.style > 0)
  2286.          REPLACE new.swapfooter WITH .T.
  2287.       ENDIF
  2288.    ENDCASE
  2289. ENDSCAN
  2290.  
  2291. * Discard the temporary cursor
  2292. SELECT old
  2293. USE
  2294.  
  2295. IF m.ftype = c_frx102repo
  2296.    * Back up the original report and copy the new information to the original file name
  2297.    m.bakname = forceext(m.fname102,"TBK")
  2298.    RENAME (m.fname102) TO (m.bakname)
  2299. ENDIF
  2300.  
  2301. * Write the new information on top of the original 1.02 report
  2302. SELECT new
  2303. COPY TO (m.fname102)
  2304. USE
  2305. SELECT (m.in_area)
  2306. RETURN m.fname102
  2307.  
  2308. *!*****************************************************************************
  2309. *!
  2310. *!      Procedure: CVRTFBPRPT
  2311. *!
  2312. *!      Called by: TRANSPRT.PRG
  2313. *!
  2314. *!          Calls: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  2315. *!               : CVTSHORT()         (function  in TRANSPRT.PRG)
  2316. *!               : CVTBYTE()          (function  in TRANSPRT.PRG)
  2317. *!               : DOCREATE           (procedure in TRANSPRT.PRG)
  2318. *!               : EVALIMPORTEXPR     (procedure in TRANSPRT.PRG)
  2319. *!               : INITBANDS          (procedure in TRANSPRT.PRG)
  2320. *!               : BLDBREAKS          (procedure in TRANSPRT.PRG)
  2321. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  2322. *!               : FORCEEXT()         (function  in TRANSPRT.PRG)
  2323. *!
  2324. *!*****************************************************************************
  2325. PROCEDURE cvrtfbprpt
  2326. * Convert a FoxBASE+ report to FoxPro 2.5 DOS format
  2327. PARAMETER m.fnamefbp, m.ftype
  2328. PRIVATE m.bakname, m.in_area, m.i, m.idbyte, m.objname, m.obj, m.rp_pool, ;
  2329.    m.rp_ltadr, m.rp_ltlen, m.rp_ssexno, m.rp_sbexno, m.rp_doublesp, ;
  2330.    m.rp_flds_width, m.rp_flds_exprno, m.rp_width, m.rp_flds_headno, ;
  2331.    m.rp_plain, m.band_rows, m.current_row, m.group_num, m.head_row
  2332.  
  2333. m.in_area = SELECT()
  2334. SELECT 0
  2335.  
  2336. m.objname       = ""
  2337. m.obj           = 0
  2338. m.rp_pool       = 0
  2339. m.rp_ltadr      = 0
  2340. m.rp_ltlen      = 0
  2341. m.rp_ssexno     = 0
  2342. m.rp_sbexno     = 0
  2343. m.rp_doublesp   = 0
  2344. m.rp_flds_width = 0
  2345. m.rp_flds_exprno= 0
  2346. m.rp_width      = 0
  2347. m.rp_flds_headno= 0
  2348. m.rp_plain      = 0
  2349. m.band_rows     = 0
  2350. m.current_row   = 0
  2351. m.group_num     = 0
  2352. m.head_row      = 0
  2353.  
  2354. * Create a set of parallel arrays to contain the report information we need to bring
  2355. * across to FoxPro 2.5 DOS.
  2356. DIMENSION rp_ltlen(maxliterals)
  2357. DIMENSION rp_ltadr(maxliterals)
  2358. DIMENSION rp_flds_width(maxrepflds)
  2359. DIMENSION rp_flds_type(maxrepflds)
  2360. DIMENSION rp_flds_totals(maxrepflds)
  2361. DIMENSION rp_flds_dp(maxrepflds)
  2362. DIMENSION rp_flds_exprno(maxrepflds)
  2363. DIMENSION rp_flds_headno(maxrepflds)
  2364. DIMENSION band_rows(10)
  2365. band_rows = 0
  2366.  
  2367. m.obj = FOPEN(m.g_scrndbf)
  2368. IF (m.obj < 1)
  2369.    DO errorhandler WITH T_NOOPENREPT_LOC,LINENO(),c_error3
  2370. ENDIF
  2371.  
  2372. m.idbyte = cvtshort(FREAD(m.obj,2),0)
  2373.  
  2374. poolsize = cvtshort(FREAD(m.obj,2),0)
  2375. FOR i = 1 TO maxliterals
  2376.    rp_ltlen(i) = cvtshort(FREAD(m.obj,2),0)
  2377. ENDFOR
  2378. FOR i = 1 TO maxliterals
  2379.    rp_ltadr(i) = cvtshort(FREAD(m.obj,2),0)
  2380. ENDFOR
  2381. rp_pool = FREAD(m.obj,litpoolsize)
  2382. FOR i = 1 TO maxrepflds
  2383.    rp_flds_width(i) = cvtshort(FREAD(m.obj,2),0)
  2384.    =FREAD(m.obj,2)
  2385.    rp_flds_type(i) = FREAD(m.obj,1)
  2386.    rp_flds_totals(i) = FREAD(m.obj,1)
  2387.    rp_flds_dp(i) = cvtshort(FREAD(m.obj,2),0)
  2388.    rp_flds_exprno(i) = cvtshort(FREAD(m.obj,2),0)
  2389.    rp_flds_headno(i) = cvtshort(FREAD(m.obj,2),0)
  2390. ENDFOR
  2391. rp_pghdno = cvtshort(FREAD(m.obj,2),0)
  2392. rp_sbexno = cvtshort(FREAD(m.obj,2),0)
  2393. rp_ssexno = cvtshort(FREAD(m.obj,2),0)
  2394. rp_sbhdno = cvtshort(FREAD(m.obj,2),0)
  2395. rp_sshdno = cvtshort(FREAD(m.obj,2),0)
  2396. rp_width = cvtshort(FREAD(m.obj,2),0)
  2397. rp_length = cvtshort(FREAD(m.obj,2),0)
  2398. rp_lmarg = cvtshort(FREAD(m.obj,2),0)
  2399. rp_rmarg = cvtshort(FREAD(m.obj,2),0)
  2400. rp_fldcnt = cvtshort(FREAD(m.obj,2),0)
  2401. rp_doublesp = FREAD(m.obj,1)
  2402. rp_summary = FREAD(m.obj, 1)
  2403. rp_subeject = FREAD(m.obj,1)
  2404. rp_other = cvtbyte(FREAD(m.obj,1),0)
  2405. rp_pageno = cvtshort(FREAD(m.obj,2),0)
  2406. =FCLOSE(m.obj)
  2407. IF (rp_pageno != 2)
  2408.    =FCLOSE(m.obj)
  2409. ENDIF
  2410.  
  2411. * Create an empty 2.5 report file
  2412. DO docreate WITH "new", c_report
  2413.  
  2414. * Fill it in
  2415. DO evalimportexpr
  2416. DO initbands
  2417. DO bldbreaks
  2418. IF rp_fldcnt > 0
  2419.    DO blddetail
  2420. ENDIF
  2421.  
  2422. * Add the header data
  2423. SELECT new
  2424. GOTO TOP
  2425. REPLACE objtype WITH 1, objcode WITH c_25frx
  2426.  
  2427. IF m.ftype = c_fbprptrepo
  2428.    * Back up the original report and copy the new information to the original file name
  2429.    m.bakname = forceext(m.fnamefbp,"TBK")
  2430.    RENAME (m.fnamefbp) TO (m.bakname)
  2431. ENDIF
  2432.  
  2433. * Write the new information to a file with an FRX extension but the
  2434. * same base name as the original FoxBASE+ report
  2435. SELECT new
  2436. COPY TO (m.fnamefbp)
  2437. USE
  2438. SELECT (m.in_area)
  2439. RETURN m.fnamefbp
  2440.  
  2441.  
  2442. *!********************************************************************
  2443. *!
  2444. *!        Convert FoxPro 1.0 label to 2.0 format
  2445. *!
  2446. *!********************************************************************
  2447.  
  2448. PROCEDURE cvrt102lbx
  2449. PARAMETERS m.fname102, m.ftype
  2450. PRIVATE m.i, m.short, m.contlen, m.obj, m.remarks, m.height, m.lmargin, m.width, ;
  2451.    m.numacross, m.spacesbet, m.linesbet, m.bakname, m.in_area
  2452.  
  2453. m.in_area = SELECT()
  2454.  
  2455. m.lblname = m.fname102
  2456.  
  2457. m.obj = FOPEN(m.lblname)
  2458. =FREAD(m.obj,1)                && Skip revision
  2459. m.remarks = FREAD(m.obj,60)
  2460. m.height = cvtshort(FREAD(m.obj,2),0)
  2461. m.lmargin = cvtshort(FREAD(m.obj,2),0)
  2462. m.width = cvtshort(FREAD(m.obj,2),0)
  2463. m.numacross = cvtshort(FREAD(m.obj,2),0)
  2464. m.spacesbet = cvtshort(FREAD(m.obj,2),0)
  2465. m.linesbet = cvtshort(FREAD(m.obj,2),0)
  2466.  
  2467. * Read in label contents -- each line ends in a CR
  2468.  
  2469. m.contlen = cvtshort(FREAD(m.obj,2),0)
  2470. m.work = FREAD(m.obj, m.contlen)
  2471. =FCLOSE(m.obj)
  2472.  
  2473. DIMENSION lbllines[m.height]
  2474. m.start = 1
  2475. m.i = 1
  2476. FOR m.curlen = 1 TO m.contlen
  2477.    IF (SUBSTR(m.work, m.curlen, 1) = CHR(13))
  2478.       lbllines[m.i] = SUBSTR(m.work, m.start, m.curlen-m.start)
  2479.       m.start = m.curlen+1
  2480.       m.i = m.i + 1
  2481.    ENDIF
  2482. ENDFOR
  2483.  
  2484. DO WHILE (m.i <= m.height)
  2485.    lbllines[m.i] = ''
  2486.    m.i = m.i + 1
  2487. ENDDO
  2488.  
  2489. * Create an empty 2.0 label
  2490. CREATE CURSOR new (objtype N(2), objcode N(2), ;
  2491.    name m, expr m, STYLE m, HEIGHT N(3), WIDTH N(3), lmargin N(3), ;
  2492.    numacross N(3), spacesbet N(3), linesbet N(3), ENVIRON l, ;
  2493.    ORDER m, "unique" l, TAG m, tag2 m, addalias l)
  2494.  
  2495. * Add the header data
  2496. SELECT new
  2497. APPEND BLANK
  2498. REPLACE new.objtype WITH 30
  2499. REPLACE new.name WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.remarks)
  2500.  
  2501. REPLACE new.height WITH m.height
  2502. REPLACE new.width WITH m.width
  2503. REPLACE new.lmargin WITH m.lmargin
  2504. REPLACE new.numacross WITH m.numacross
  2505. REPLACE new.spacesbet WITH m.spacesbet
  2506. REPLACE new.linesbet WITH m.linesbet
  2507.  
  2508. * Add the label contents
  2509.  
  2510. FOR m.i = 1 TO m.height
  2511.    APPEND BLANK
  2512.    REPLACE new.objtype WITH 19
  2513.    REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,lbllines[m.i])
  2514. ENDFOR
  2515.  
  2516. IF m.ftype = c_lbx102repo
  2517.    * Back up the original label and copy the new information to the original file name
  2518.    m.bakname = forceext(m.fname102,"TBK")
  2519.    RENAME (m.fname102) TO (m.bakname)
  2520. ENDIF
  2521.  
  2522. * Write the new information on top of the original 1.02 label
  2523. SELECT new
  2524. COPY TO (m.fname102)
  2525. USE
  2526. SELECT (m.in_area)
  2527. RETURN m.fname102
  2528.  
  2529.  
  2530. RETURN
  2531.  
  2532. *!********************************************************************
  2533. *!
  2534. *!        Convert FoxBase+ label to 2.0 format
  2535. *!
  2536. *!********************************************************************
  2537.  
  2538. PROCEDURE cvrtfbplbl
  2539. PARAMETERS m.fnamefbp, m.ftype
  2540.  
  2541. PRIVATE m.width, m.height, m.lmargin, m.spacesbet, m.linesbet, m.numacross, m.obj, ;
  2542.    m.i, m.lblname, m.in_area, m.dummy
  2543.  
  2544. m.in_area = SELECT()
  2545.  
  2546. m.lblname = m.fnamefbp
  2547.  
  2548. m.width = 0
  2549. m.height = 0
  2550. m.lmargin = 0
  2551. m.spacesbet = 0
  2552. m.linesbet = 0
  2553. m.numacross = 0
  2554.  
  2555. m.obj = FOPEN(m.lblname)
  2556. =FREAD(m.obj,1)                && Skip revision
  2557. m.remarks = FREAD(m.obj,60)
  2558. m.height = cvtshort(FREAD(m.obj,2),0)
  2559. m.width = cvtshort(FREAD(m.obj,2),0)
  2560. m.lmargin = cvtshort(FREAD(m.obj,2),0)
  2561. m.linesbet = cvtshort(FREAD(m.obj,2),0)
  2562. m.spacesbet = cvtshort(FREAD(m.obj,2),0)
  2563. m.numacross = cvtshort(FREAD(m.obj,2),0)
  2564.  
  2565. *******************************************************
  2566. * Read the label contents -- strip spaces and add a CR
  2567. *******************************************************
  2568.  
  2569. DIMENSION lbllines[m.height]
  2570. lbllines = '""'
  2571. m.lastline = 0
  2572. FOR m.i = 1 TO m.height
  2573.    m.olen = 60
  2574.    m.work = FREAD(m.obj,m.olen)
  2575.    DO WHILE ((m.olen > 0) AND (SUBSTR(m.work, m.olen, 1) = ' '))
  2576.       m.olen = m.olen - 1
  2577.    ENDDO
  2578.    =STUFF(m.work, m.olen, 1, '\n')
  2579.    lbllines[m.i] = SUBSTR(m.work, 1, m.olen+1)
  2580.    IF EMPTY(lbllines[m.i])
  2581.       lbllines[m.i] = '""'
  2582.    ELSE
  2583.       m.lastline = m.i
  2584.    ENDIF
  2585. ENDFOR
  2586.  
  2587. =FCLOSE(m.obj)
  2588.  
  2589. CREATE CURSOR new (objtype N(2), objcode N(2), ;
  2590.    name m, expr m, STYLE m, HEIGHT N(3), WIDTH N(3), lmargin N(3), ;
  2591.    numacross N(3), spacesbet N(3), linesbet N(3), ENVIRON l, ;
  2592.   ORDER m, "unique" l, TAG m, tag2 m, addalias l)
  2593.  
  2594. * Add the header data
  2595. SELECT new
  2596. APPEND BLANK
  2597. REPLACE new.objtype WITH 30
  2598. REPLACE new.name WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.remarks)
  2599.  
  2600. REPLACE new.height WITH m.height
  2601. REPLACE new.width WITH m.width
  2602. REPLACE new.lmargin WITH m.lmargin
  2603. REPLACE new.numacross WITH m.numacross
  2604. REPLACE new.spacesbet WITH m.spacesbet
  2605. REPLACE new.linesbet WITH m.linesbet
  2606.  
  2607. FOR m.i = 1 TO m.lastline
  2608.    APPEND BLANK
  2609.    REPLACE new.objtype WITH 19
  2610.    REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,lbllines[m.i])
  2611. ENDFOR
  2612.  
  2613. IF m.ftype = c_fbprptrepo
  2614.    * Back up the original report and copy the new information to the original file name
  2615.    m.bakname = forceext(m.fnamefbp,"TBK")
  2616.    RENAME (m.fnamefbp) TO (m.bakname)
  2617. ENDIF
  2618.  
  2619. * Write the new information to a file with an LBX extension but the
  2620. * same base name as the original FoxBASE+ label.
  2621. SELECT new
  2622. COPY TO (m.fnamefbp)
  2623. USE
  2624. SELECT (m.in_area)
  2625. RETURN m.fnamefbp
  2626.  
  2627. *!*****************************************************************************
  2628. *!
  2629. *!      Procedure: INITBANDS
  2630. *!
  2631. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  2632. *!
  2633. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  2634. *!               : LINESFORHEADING()  (function  in TRANSPRT.PRG)
  2635. *!               : FLD_HEAD_EXIST()   (function  in TRANSPRT.PRG)
  2636. *!               : HOWMANYHEADINGS()  (function  in TRANSPRT.PRG)
  2637. *!               : MAKEBAND           (procedure in TRANSPRT.PRG)
  2638. *!               : TOTALS_EXIST()     (function  in TRANSPRT.PRG)
  2639. *!               : MAKETEXT           (procedure in TRANSPRT.PRG)
  2640. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2641. *!               : GETHEADING()       (function  in TRANSPRT.PRG)
  2642. *!               : CENTER_COL()       (function  in TRANSPRT.PRG)
  2643. *!
  2644. *!*****************************************************************************
  2645. PROCEDURE initbands
  2646.  
  2647. APPEND BLANK
  2648. REPLACE new->platform WITH c_dosname
  2649. REPLACE new->WIDTH WITH m.rp_width
  2650. REPLACE new->HEIGHT WITH m.rp_length
  2651. REPLACE new->offset WITH m.rp_lmarg
  2652. REPLACE new->ejectbefor WITH .T.
  2653. m.rp_plain = 0
  2654. m.group_num = 0
  2655. IF ("Y" = m.rp_summary)
  2656.    REPLACE new->SUMMARY WITH .T.
  2657. ENDIF
  2658. IF (INLIST(m.rp_other,1,3,5,7))
  2659.    REPLACE new->ejectbefor WITH .F.
  2660. ENDIF
  2661. IF (INLIST(m.rp_other,3,6,7))
  2662.    REPLACE new->ejectafter WITH .T.
  2663. ENDIF
  2664. IF (INLIST(m.rp_other,4,5,6,7))
  2665.    REPLACE new->PLAIN WITH .T.
  2666.    m.rp_plain = 1
  2667. ENDIF
  2668. m.rp_totals = 0
  2669. m.current_row = 0
  2670.  
  2671. * header band
  2672.  
  2673. m.bandsize = 1
  2674. IF (m.rp_plain = 0)
  2675.    m.bandsize = m.bandsize + 2
  2676. ENDIF
  2677.  
  2678. m.string = ""
  2679. IF (getlitexpr(m.rp_pghdno, @m.string) <> 0)
  2680.    m.size = linesforheading(m.string)
  2681.    m.bandsize = m.bandsize + m.size
  2682. ENDIF
  2683.  
  2684. IF (fld_head_exist() = 1)
  2685.    m.size = howmanyheadings()
  2686.    m.bandsize = m.bandsize + m.size + 3
  2687. ELSE
  2688.    m.bandsize = m.bandsize + 3
  2689. ENDIF
  2690.  
  2691. DO makeband WITH h_page, m.bandsize, "", .F.
  2692.  
  2693. * group bands
  2694. m.bandstring = ""
  2695. IF (getlitexpr(m.rp_sbexno, @m.bandstring) <> 0)
  2696.    IF ("Y" = m.rp_subeject)
  2697.       m.newpage = .T.
  2698.    ELSE
  2699.       m.newpage = .F.
  2700.    ENDIF
  2701.    DO makeband WITH h_break, 2, m.bandstring, m.newpage
  2702.    m.rp_totals = m.rp_totals + 1
  2703.    IF (getlitexpr(m.rp_ssexno, @m.bandstring) <> 0)
  2704.       DO makeband WITH h_break, 2, m.bandstring, .F.
  2705.       m.rp_totals = m.rp_totals + 1
  2706.    ENDIF
  2707. ENDIF
  2708.  
  2709. group_num = rp_totals
  2710. m.numlines = 1
  2711. IF ("Y" = m.rp_doublesp)
  2712.    m.numlines = 2
  2713. ENDIF
  2714.  
  2715. * detail band
  2716. DO makeband WITH l_item, m.numlines, "", .F.
  2717.  
  2718. * break footer bands
  2719. IF (totals_exist() = 1)
  2720.    m.bandsize = 2
  2721. ELSE
  2722.    m.bandsize = 1
  2723. ENDIF
  2724.  
  2725. m.groupnum = m.rp_totals
  2726.  
  2727. FOR i = 1 TO m.rp_totals
  2728.    DO makeband WITH f_break, m.bandsize, "", .F.
  2729. ENDFOR
  2730.  
  2731. * page footer band
  2732. DO makeband WITH f_page, 1, "", .F.
  2733.  
  2734. * report footer band
  2735. DO makeband WITH f_rpt, m.bandsize, "", .F.
  2736.  
  2737. IF (rp_plain = 0)
  2738.    DO maketext WITH 9, 1, "PAGE NO. ", band_rows(h_page)+1, 0
  2739.    DO makefield WITH 5, 1, "_PAGENO", band_rows(h_page)+1, 9, "C", .F., .F., 0, 0
  2740.    DO makefield WITH 8, 1, "DATE()", band_rows(h_page)+2, 0, "D", .F., .F., 0, 0
  2741.    m.head_row = 3
  2742. ELSE
  2743.    m.head_row = 0
  2744. ENDIF
  2745.  
  2746. IF (getlitexpr(m.rp_pghdno,@m.string) <> 0)
  2747.    m.string = m.string + ";"
  2748.    m.heading = ""
  2749.    DO WHILE .T.
  2750.       IF (getheading(@m.heading, @m.string) > 0)
  2751.          DO maketext WITH LEN(m.heading), 1, m.heading, m.head_row, center_col(LEN(m.heading))
  2752.          m.head_row = m.head_row + 1
  2753.       ELSE
  2754.          EXIT
  2755.       ENDIF
  2756.    ENDDO
  2757. ENDIF
  2758.  
  2759. m.head_row = m.head_row + 1
  2760.  
  2761. RETURN
  2762.  
  2763. *!*****************************************************************************
  2764. *!
  2765. *!      Procedure: BLDBREAKEXP
  2766. *!
  2767. *!      Called by: BLDBREAKS          (procedure in TRANSPRT.PRG)
  2768. *!
  2769. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  2770. *!               : MAKETEXT           (procedure in TRANSPRT.PRG)
  2771. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2772. *!
  2773. *!*****************************************************************************
  2774. PROCEDURE bldbreakexp
  2775. PARAMETER m.exprno, m.headno, m.row, m.stars
  2776.  
  2777. PRIVATE m.string
  2778. m.string = ""
  2779. =getlitexpr(m.headno, @m.string)
  2780. m.string = m.stars + m.string
  2781. strlen = LEN(m.string)
  2782. DO maketext WITH m.strlen, 1, m.string, m.row, 0
  2783. =getlitexpr(m.exprno, @m.string)
  2784. DO makefield WITH rp_ltlen(m.exprno+1), 1, m.string, m.row, m.strlen + 1, "C", .F., .F., 0, 0
  2785. RETURN
  2786.  
  2787. *!*****************************************************************************
  2788. *!
  2789. *!      Procedure: BLDBREAKS
  2790. *!
  2791. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  2792. *!
  2793. *!          Calls: LITEXIST()         (function  in TRANSPRT.PRG)
  2794. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  2795. *!
  2796. *!*****************************************************************************
  2797. PROCEDURE bldbreaks
  2798. IF (litexist(rp_sbexno) = 1)
  2799.    DO bldbreakexp WITH rp_sbexno, rp_sbhdno, band_rows(h_break) + 1, "** "
  2800.    IF (litexist(rp_ssexno) = 1)
  2801.       DO bldbreakexp WITH rp_ssexno, rp_sshdno, band_rows(h_break) + 3, "*"
  2802.    ENDIF
  2803. ENDIF
  2804. RETURN
  2805.  
  2806. *!*****************************************************************************
  2807. *!
  2808. *!      Procedure: BLDDETAIL
  2809. *!
  2810. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  2811. *!
  2812. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  2813. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2814. *!               : ADDTOTAL           (procedure in TRANSPRT.PRG)
  2815. *!               : GETHEADING()       (function  in TRANSPRT.PRG)
  2816. *!               : MAKETEXT           (procedure in TRANSPRT.PRG)
  2817. *!
  2818. *!*****************************************************************************
  2819. PROCEDURE blddetail
  2820. PRIVATE m.i, m.pg_row, m.istotal, m.fcol, m.row, m.string, m.col, m.heading
  2821.  
  2822. m.pg_row = 0
  2823. m.istotal = 0
  2824. m.fcol = 0
  2825. m.row = band_rows(l_item)
  2826. m.string = ""
  2827. FOR m.i = 1 TO rp_fldcnt
  2828.    IF (getlitexpr(rp_flds_exprno(m.i), @m.string) <> 0)
  2829.       m.row = band_rows(l_item)
  2830.       IF (m.fcol + rp_flds_width(m.i) > m.rp_width - 1)
  2831.          rp_flds_width(m.i) = rp_flds_width(m.i) - (m.fcol + rp_flds_width(m.i) - m.rp_width)
  2832.          IF (rp_flds_width(m.i) < 0)
  2833.             EXIT
  2834.          ENDIF
  2835.       ENDIF
  2836.       DO makefield WITH rp_flds_width(m.i), 1, m.string, m.row, m.fcol, rp_flds_type(m.i), .T., .T., 0, 0
  2837.       IF ("Y" = rp_flds_totals(m.i))
  2838.          DO makefield WITH rp_flds_width(m.i), 1, m.string, band_rows(f_rpt) + 1, m.fcol, "N", .F., .F., 2, 0
  2839.          IF (m.group_num > 0)
  2840.             IF (m.group_num > 1)
  2841.                DO addtotal WITH m.istotal, band_rows(f_break), m.fcol, rp_flds_width(m.i), m.string, "* Subsubtotal *", 4
  2842.                DO addtotal WITH m.istotal, band_rows(f_break) + 2, m.fcol, rp_flds_width(m.i), m.string, "** Subtotal **", 3
  2843.             ELSE
  2844.                DO addtotal WITH m.istotal, band_rows(f_break), m.fcol, rp_flds_width(m.i), m.string, "** Subtotal **", 3
  2845.             ENDIF
  2846.          ENDIF
  2847.          m.istotal = 1
  2848.       ENDIF
  2849.    ENDIF
  2850.  
  2851.    IF (getlitexpr(rp_flds_headno(m.i), @m.string) <> 0)
  2852.       m.string = m.string + ";"
  2853.       m.heading = ""
  2854.       m.hrow = m.head_row
  2855.       DO WHILE .T.
  2856.          IF (getheading(@m.heading, @m.string) > 0)
  2857.             IF (rp_flds_type(m.i) = "N")
  2858.                m.col = (m.fcol + rp_flds_width(m.i)) - LEN(m.heading)
  2859.             ELSE
  2860.                m.col = m.fcol
  2861.             ENDIF
  2862.             DO maketext WITH LEN(m.heading), 1, m.heading, m.hrow, m.col
  2863.             m.hrow = m.hrow + 1
  2864.          ELSE
  2865.             EXIT
  2866.          ENDIF
  2867.       ENDDO
  2868.    ENDIF
  2869.    m.fcol = m.fcol + rp_flds_width(m.i) + 1
  2870. ENDFOR
  2871.  
  2872. IF (m.istotal = 1)
  2873.    DO maketext WITH 13, 1, T_TOTAL1_LOC, band_rows(f_rpt), 0
  2874. ENDIF
  2875.  
  2876. RETURN
  2877.  
  2878. *!*****************************************************************************
  2879. *!
  2880. *!      Procedure: ADDTOTAL
  2881. *!
  2882. *!      Called by: BLDDETAIL          (procedure in TRANSPRT.PRG)
  2883. *!
  2884. *!          Calls: MAKETEXT           (procedure in TRANSPRT.PRG)
  2885. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2886. *!
  2887. *!*****************************************************************************
  2888. PROCEDURE addtotal
  2889. PARAMETER m.isfirst, m.row, m.col, m.wt, m.workstr, m.totalstr, m.reset
  2890. IF (m.isfirst = 0)
  2891.    DO maketext WITH LEN(m.totalstr), 1, m.totalstr, m.row, 0
  2892. ENDIF
  2893. DO makefield WITH m.wt, 1, m.workstr, m.row+1, m.col, "N", .F., .F., 2, m.reset
  2894. RETURN
  2895.  
  2896.  
  2897. *!*****************************************************************************
  2898. *!
  2899. *!       Function: LITEXIST
  2900. *!
  2901. *!      Called by: BLDBREAKS          (procedure in TRANSPRT.PRG)
  2902. *!               : GETLITEXPR()       (function  in TRANSPRT.PRG)
  2903. *!               : FLD_HEAD_EXIST()   (function  in TRANSPRT.PRG)
  2904. *!
  2905. *!*****************************************************************************
  2906. FUNCTION litexist
  2907. PARAMETER m.idx
  2908. PRIVATE m.flag
  2909. m.flag = 0
  2910. IF m.idx != 65535
  2911.    IF "" <> SUBSTR(rp_pool, rp_ltadr(m.idx+1)+1, 1)
  2912.       m.flag = 1
  2913.    ENDIF
  2914. ENDIF
  2915. RETURN m.flag
  2916.  
  2917. *!*****************************************************************************
  2918. *!
  2919. *!       Function: GETLITEXPR
  2920. *!
  2921. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  2922. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  2923. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  2924. *!               : HOWMANYHEADINGS()  (function  in TRANSPRT.PRG)
  2925. *!               : EVALIMPORTEXPR     (procedure in TRANSPRT.PRG)
  2926. *!
  2927. *!          Calls: LITEXIST()         (function  in TRANSPRT.PRG)
  2928. *!
  2929. *!*****************************************************************************
  2930. FUNCTION getlitexpr
  2931. PARAMETER m.idx, m.string
  2932. m.flag = 0
  2933. IF (litexist(m.idx) = 1)
  2934.    m.string = SUBSTR(m.rp_pool, rp_ltadr(m.idx+1)+1, rp_ltlen(m.idx+1) - 1)
  2935.    m.flag = 1
  2936. ELSE
  2937.    m.string = ""
  2938. ENDIF
  2939. RETURN m.flag
  2940.  
  2941. *!*****************************************************************************
  2942. *!
  2943. *!      Procedure: MAKEBAND
  2944. *!
  2945. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  2946. *!
  2947. *!*****************************************************************************
  2948. PROCEDURE makeband
  2949. PARAMETER m.type, m.size, m.string, m.newpage
  2950. APPEND BLANK
  2951. REPLACE new->platform WITH c_dosname
  2952. REPLACE new->objtype WITH 9
  2953. REPLACE new->objcode WITH m.type
  2954. REPLACE new->expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.string)
  2955. REPLACE new->HEIGHT WITH m.size
  2956. REPLACE new->pagebreak WITH m.newpage
  2957. IF (band_rows(m.type) = 0)
  2958.    band_rows(m.type) = m.current_row
  2959. ENDIF
  2960. m.current_row = m.current_row + m.size
  2961. RETURN
  2962.  
  2963. *!*****************************************************************************
  2964. *!
  2965. *!      Procedure: MAKETEXT
  2966. *!
  2967. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  2968. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  2969. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  2970. *!               : ADDTOTAL           (procedure in TRANSPRT.PRG)
  2971. *!
  2972. *!*****************************************************************************
  2973. PROCEDURE maketext
  2974. PARAMETER  wt, ht, string, ROW, COL
  2975. IF m.wt > 0
  2976.    APPEND BLANK
  2977.    REPLACE new->platform WITH c_dosname
  2978.    REPLACE new->expr WITH '"' + CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.string) + '"'
  2979.    REPLACE new->objtype WITH 5
  2980.    REPLACE new->height WITH ht
  2981.    REPLACE new->WIDTH WITH wt
  2982.    REPLACE new->vpos WITH ROW
  2983.    REPLACE new->hpos WITH COL
  2984. ENDIF
  2985. RETURN
  2986.  
  2987. *!*****************************************************************************
  2988. *!
  2989. *!      Procedure: MAKEFIELD
  2990. *!
  2991. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  2992. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  2993. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  2994. *!               : ADDTOTAL           (procedure in TRANSPRT.PRG)
  2995. *!
  2996. *!*****************************************************************************
  2997. PROCEDURE makefield
  2998. PARAMETER m.wt, m.ht, m.string, m.row, m.col, m.fldchar, m.strch, m.flt, m.total, m.reset
  2999.  
  3000. APPEND BLANK
  3001. REPLACE new->platform WITH c_dosname
  3002. REPLACE new->objtype WITH 8
  3003. REPLACE new->expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.string)
  3004. REPLACE new->height WITH m.ht
  3005. REPLACE new->WIDTH WITH m.wt
  3006. REPLACE new->vpos WITH m.row
  3007. REPLACE new->hpos WITH m.col
  3008. REPLACE new->fillchar WITH m.fldchar
  3009. REPLACE new->STRETCH WITH m.strch
  3010. REPLACE new->FLOAT WITH m.flt
  3011. REPLACE new->totaltype WITH m.total
  3012. REPLACE new->resettotal WITH m.reset
  3013. RETURN
  3014.  
  3015. *!*****************************************************************************
  3016. *!
  3017. *!       Function: GETHEADING
  3018. *!
  3019. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3020. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  3021. *!               : LINESFORHEADING()  (function  in TRANSPRT.PRG)
  3022. *!
  3023. *!*****************************************************************************
  3024. FUNCTION getheading
  3025. PARAMETER m.heading, m.string
  3026. PRIVATE m.flag, m.x, m.heading
  3027. m.flag = 0
  3028. m.x = AT(';',m.string)
  3029. m.heading = SUBSTR(m.string, 1, m.x-1)
  3030. m.string = SUBSTR(m.string, m.x+1)
  3031. IF (LEN(m.string) > 0)   && more left
  3032.    m.flag = 1
  3033. ENDIF
  3034. IF (LEN(m.heading) > 0)
  3035.    m.flag = 1
  3036. ENDIF
  3037. RETURN m.flag
  3038.  
  3039. *!*****************************************************************************
  3040. *!
  3041. *!       Function: LINESFORHEADING
  3042. *!
  3043. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3044. *!               : HOWMANYHEADINGS()  (function  in TRANSPRT.PRG)
  3045. *!
  3046. *!          Calls: GETHEADING()       (function  in TRANSPRT.PRG)
  3047. *!
  3048. *!*****************************************************************************
  3049. FUNCTION linesforheading
  3050. PARAMETER m.string
  3051. PRIVATE m.retval, m.string2, m.heading
  3052. m.string2 = m.string + ";"
  3053. m.heading = ""
  3054. m.retval = 0
  3055. DO WHILE .T.
  3056.    IF (getheading(@m.heading, @m.string2) > 0)
  3057.       m.retval = m.retval + 1
  3058.    ELSE
  3059.       EXIT
  3060.    ENDIF
  3061. ENDDO
  3062. RETURN m.retval
  3063.  
  3064. *!*****************************************************************************
  3065. *!
  3066. *!       Function: HOWMANYHEADINGS
  3067. *!
  3068. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3069. *!
  3070. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  3071. *!               : LINESFORHEADING()  (function  in TRANSPRT.PRG)
  3072. *!
  3073. *!*****************************************************************************
  3074. FUNCTION howmanyheadings
  3075. PRIVATE m.retval, m.i, m.newval
  3076. m.retval = 0
  3077. FOR m.i = 1 TO m.rp_fldcnt
  3078.    IF (getlitexpr(rp_flds_headno, @m.string) <> 0)
  3079.       m.newval = linesforheading(m.string)
  3080.       m.retval = MAX(m.newval, m.retval)
  3081.    ENDIF
  3082. ENDFOR
  3083. RETURN m.retval
  3084.  
  3085. *!*****************************************************************************
  3086. *!
  3087. *!       Function: FLD_HEAD_EXIST
  3088. *!
  3089. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3090. *!
  3091. *!          Calls: LITEXIST()         (function  in TRANSPRT.PRG)
  3092. *!
  3093. *!*****************************************************************************
  3094. FUNCTION fld_head_exist
  3095. PRIVATE m.flag, m.i
  3096. m.flag = 0
  3097. FOR m.i = 1 TO m.rp_fldcnt
  3098.    IF (litexist(rp_flds_headno(m.i)) = 1)
  3099.       m.flag = 1
  3100.       EXIT
  3101.    ENDIF
  3102. ENDFOR
  3103. RETURN m.flag
  3104.  
  3105. *!*****************************************************************************
  3106. *!
  3107. *!       Function: TOTALS_EXIST
  3108. *!
  3109. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3110. *!
  3111. *!*****************************************************************************
  3112. FUNCTION totals_exist
  3113. PRIVATE m.flag, m.i
  3114. m.flag = 0
  3115. FOR m.i = 1 TO m.rp_fldcnt
  3116.    IF ("Y" = rp_flds_totals(m.i))
  3117.       m.flag = 1
  3118.       EXIT
  3119.    ENDIF
  3120. ENDFOR
  3121. RETURN m.flag
  3122.  
  3123. *!*****************************************************************************
  3124. *!
  3125. *!       Function: CENTER_COL
  3126. *!
  3127. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3128. *!
  3129. *!*****************************************************************************
  3130. FUNCTION center_col
  3131. PARAMETER m.length
  3132. RETURN (MAX(0, ((m.rp_width - m.rp_lmarg - m.rp_rmarg) - m.length)/2))
  3133.  
  3134. *!*****************************************************************************
  3135. *!
  3136. *!      Procedure: EVALIMPORTEXPR
  3137. *!
  3138. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  3139. *!
  3140. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  3141. *!
  3142. *!*****************************************************************************
  3143. PROCEDURE evalimportexpr
  3144. PRIVATE string
  3145. m.string = ""
  3146. FOR i = 1 TO rp_fldcnt
  3147.    IF (getlitexpr(rp_flds_exprno(i), @string) <> 0)
  3148.       rp_flds_type(i) = TYPE(m.string)
  3149.       IF ("U" = rp_flds_type(i))
  3150.          rp_flds_type = "C"
  3151.       ENDIF
  3152.    ENDIF
  3153. ENDFOR
  3154. RETURN
  3155.  
  3156. *!*****************************************************************************
  3157. *!
  3158. *!       Function: GETOLDREPORTTYPE
  3159. *!
  3160. *!      Called by: TRANSPRT.PRG
  3161. *!
  3162. *!          Calls: CVTSHORT()         (function  in TRANSPRT.PRG)
  3163. *!
  3164. *!*****************************************************************************
  3165. FUNCTION getoldreporttype
  3166. * Open the main file and see what kind of file it is.  At this point, all we know
  3167. * is that it is either a FoxPro 1.02 report or a FoxBASE+ report, or possibly
  3168. * a report from some other product.
  3169.  
  3170. PRIVATE m.fp, m.reptotals, m.retcode, m.tag
  3171. m.retcode = m.tp_filetype
  3172.  
  3173. m.fp = FOPEN(m.g_scrndbf)
  3174. IF fp > 0
  3175.    m.reptotals = cvtshort(FREAD(m.fp,2),0)
  3176.    DO CASE
  3177.    CASE (m.reptotals == 2)   && FoxBASE+ report
  3178.       DO CASE
  3179.       CASE m.tp_filetype = c_frx102modi
  3180.          m.retcode= c_fbprptmodi
  3181.       CASE m.tp_filetype = c_frx102repo
  3182.          m.retcode = c_fbprptrepo
  3183.       OTHERWISE
  3184.          m.retcode = c_fbprptrepo
  3185.       ENDCASE
  3186.    OTHERWISE
  3187.         * Check for alien report
  3188.         =FSEEK(m.fp,0)
  3189.         m.tag = FREAD(m.fp,8)
  3190.         IF UPPER(m.tag) == "DBASE IV"
  3191.             m.retcode = c_db4type
  3192.         ELSE
  3193.           m.retcode = m.tp_filetype
  3194.         ENDIF
  3195.    ENDCASE
  3196.    =FCLOSE(m.fp)
  3197. ENDIF
  3198. RETURN m.retcode
  3199.  
  3200. *!*****************************************************************************
  3201. *!
  3202. *!       Function: GETOLDLABELTYPE
  3203. *!
  3204. *!      Called by: TRANSPRT.PRG
  3205. *!
  3206. *!          Calls: CVTSHORT()         (function  in TRANSPRT.PRG)
  3207. *!
  3208. *!*****************************************************************************
  3209. FUNCTION getoldlabeltype
  3210. * Open the main file and see what kind of file it is.  At this point, all we know
  3211. * is that it is either a FoxPro 1.02 report or a FoxBASE+ label.
  3212.  
  3213. PRIVATE m.fp, m.reptotals, m.retcode
  3214. m.retcode = m.tp_filetype
  3215.  
  3216. m.fp = FOPEN(m.g_scrndbf)
  3217. IF fp > 0
  3218.    m.reptotals = cvtbyte(FREAD(m.fp,1),0)
  3219.    m.dummy     = FREAD(m.fp,1)   && skip this one
  3220.    DO CASE
  3221.    CASE (m.reptotals == 2)   && FoxBASE+ label
  3222.       DO CASE
  3223.       CASE m.tp_filetype = c_lbx102modi
  3224.          m.retcode= c_fbplblmodi
  3225.       CASE m.tp_filetype = c_lbx102repo
  3226.          m.retcode = c_fbplblrepo
  3227.       OTHERWISE
  3228.          m.retcode = c_fbplblrepo
  3229.       ENDCASE
  3230.    OTHERWISE
  3231.         * Check for alien report
  3232.         =FSEEK(m.fp,0)
  3233.         m.tag = FREAD(m.fp,8)
  3234.         IF UPPER(m.tag) == "DBASE IV"
  3235.             m.retcode = c_db4type
  3236.         ELSE
  3237.           m.retcode = m.tp_filetype
  3238.         ENDIF
  3239.    ENDCASE
  3240.    =FCLOSE(m.fp)
  3241. ENDIF
  3242. RETURN m.retcode
  3243.  
  3244. *
  3245. * MAPBUTTON - Compare two sets of buttons
  3246. *
  3247. *!*****************************************************************************
  3248. *!
  3249. *!       Function: MAPBUTTON
  3250. *!
  3251. *!      Called by: UPDATESCREEN       (procedure in TRANSPRT.PRG)
  3252. *!
  3253. *!          Calls: SCATTERBUTTONS     (procedure in TRANSPRT.PRG)
  3254. *!
  3255. *!*****************************************************************************
  3256. FUNCTION mapbutton
  3257. PARAMETER frombtn, tobtn
  3258. PRIVATE m.endpos, m.outstrg, m.topos, m.i, m.pictclau
  3259. m.pictclau = LEFT(m.tobtn,AT(' ',m.tobtn)-1)
  3260. DO CASE
  3261. CASE m.g_grph2char
  3262.    * Strip out the BMP extensions, if present
  3263.    m.frombtn = STRTRAN(m.frombtn,".BMP","")
  3264.    m.frombtn = STRTRAN(m.frombtn,".bmp","")
  3265.  
  3266. CASE ".BMP" $ UPPER(m.tobtn)
  3267.    * Add back in the bitmap extensions, if the to platform already has some.  The
  3268.    * strategy is to mark all existing bitmap extensions, then add one to each of the
  3269.    * atoms in the picture clause.
  3270.    DO CASE
  3271.    CASE RIGHT(m.tobtn,1) = '"' OR RIGHT(m.tobtn,1) = "'"
  3272.       m.tobtn = STUFF(m.tobtn,LEN(m.tobtn),0,';')
  3273.    OTHERWISE
  3274.       m.tobtn = m.tobtn + ';'
  3275.    ENDCASE
  3276.  
  3277.    * 'brlfq' is just a marker for where a semicolon needs to go.  Mark all the existing
  3278.    * BMP extensions.
  3279.    m.tobtn = STRTRAN(m.tobtn,".BMP;",".BMPbrlfq")
  3280.    m.tobtn = STRTRAN(m.tobtn,".bmp;",".BMPbrlfq")
  3281.  
  3282.    * Add a new BMP extension where there wasn't one before.
  3283.    m.tobtn = STRTRAN(m.tobtn,";",".BMPbrlfq")
  3284.  
  3285.    * Put the semicolons back
  3286.    m.tobtn = STRTRAN(m.tobtn,"brlfq",";")
  3287.  
  3288.    * Remove trailing semicolons
  3289.    DO WHILE RIGHT(m.tobtn,2) = ';"' OR RIGHT(m.tobtn,2) = ";'"
  3290.       m.tobtn = STUFF(m.tobtn,LEN(m.tobtn)-1,1,"")
  3291.    ENDDO
  3292.  
  3293.    * Now make sure there is a 'B' in the picture clause
  3294.    IF !("B" $ m.pictclau) AND ("@" $ m.pictclau)
  3295.       m.tobtn = STUFF(m.tobtn,AT("@",m.tobtn)+2,0,"B")
  3296.       m.pictclau = m.pictclau + "B"
  3297.    ENDIF
  3298. ENDCASE
  3299.  
  3300. DO CASE
  3301. CASE m.frombtn == m.tobtn
  3302.    RETURN m.frombtn
  3303. CASE OCCURS(';',m.frombtn) = OCCURS(';',m.tobtn)
  3304.    IF m.g_char2grph AND ("B" $ m.pictclau)
  3305.       * Return the newly modified "to" string in this case.
  3306.       RETURN m.tobtn
  3307.    ELSE
  3308.       RETURN m.frombtn
  3309.    ENDIF
  3310. CASE OCCURS(';',m.frombtn) > OCCURS(';',m.tobtn)
  3311.    * Are these bitmap buttons?
  3312.    IF ("B" $ m.pictclau)
  3313.       * Just add a blank one to the end
  3314.       m.endpos = RAT('"',m.tobtn)
  3315.       IF endpos > 1
  3316.          RETURN STUFF(m.tobtn,m.endpos,0,';NEW.BMP')
  3317.       ELSE
  3318.          RETURN m.tobtn + ';'
  3319.       ENDIF
  3320.    ELSE
  3321.       * Not bitmaps.
  3322.       RETURN m.frombtn
  3323.    ENDIF
  3324. OTHERWISE
  3325.    RETURN m.frombtn
  3326.  
  3327.    * An alternative strategy is to try to preserve as many as possible of the
  3328.    * destination buttons, especially since they might contain bitmaps, etc.
  3329.  
  3330.    * Populate two arrays with the button prompts.  Then scan through the
  3331.    * 'from' array seeing if we can match it up against something in the 'to'
  3332.    * array.  If so, emit the 'to' array picture.  Otherwise, emit the 'from'
  3333.    * one.
  3334.    DIMENSION fromarray[1], toarray[1]
  3335.    DO scatterbuttons WITH m.frombtn, fromarray
  3336.    DO scatterbuttons WITH m.tobtn, toarray
  3337.    outstrg = ""
  3338.    FOR m.i = 1 TO ALEN(fromarray)
  3339.       m.topos = ASCAN(toarray,fromarray[i])
  3340.       IF m.topos > 0
  3341.          m.outstrg = m.outstrg + IIF(EMPTY(m.outstrg),'',';') + toarray[m.topos]
  3342.       ELSE
  3343.          m.outstrg = m.outstrg + IIF(EMPTY(m.outstrg),'',';') + fromarray[m.i]
  3344.       ENDIF
  3345.    ENDFOR
  3346.    m.outstrg = LEFT(m.frombtn,AT(' ',m.frombtn)) + m.outstrg + '"'
  3347.    RETURN m.outstrg
  3348. ENDCASE
  3349.  
  3350. *!*****************************************************************************
  3351. *!
  3352. *!      Procedure: SCATTERBUTTONS
  3353. *!
  3354. *!      Called by: MAPBUTTON()        (function  in TRANSPRT.PRG)
  3355. *!
  3356. *!*****************************************************************************
  3357. PROCEDURE scatterbuttons
  3358. PARAMETERS btnlist, destarray
  3359. PRIVATE m.i, m.fromstrg, m.num, m.theword
  3360. m.fromstrg = SUBSTR(m.btnlist,AT(' ',m.btnlist)+1)
  3361. m.fromstrg = CHRTRANC(m.fromstrg,CHR(34)+CHR(39),"")
  3362. m.num = OCCURS(';',m.fromstrg)
  3363. DIMENSION destarray[m.num+1]
  3364. FOR m.i = 1 TO m.num + 1
  3365.    DO CASE
  3366.    CASE m.i = 1    && first button
  3367.       m.theword = LEFT(m.fromstrg,AT(';',m.fromstrg)-1)
  3368.    CASE m.i = m.num + 1   && last button
  3369.       m.theword = SUBSTR(m.fromstrg,AT(';',m.fromstrg,m.num)+1)
  3370.    OTHERWISE
  3371.       m.theword = SUBSTR(m.fromstrg,AT(';',m.fromstrg,m.i-1)+1, ;
  3372.          AT(';',m.fromstrg,m.i) - AT(';',m.fromstrg,m.i-1))
  3373.    ENDCASE
  3374.    destarray[m.i] = UPPER(ALLTRIM(m.theword))
  3375. ENDFOR
  3376. RETURN
  3377.  
  3378. *
  3379. * FindLikeVpos - Tries to find an object in the from platform with a vpos that matches the vpos
  3380. *      of a new object we are adding.  If it finds one, we return that objects Vpos in the to
  3381. *      platform.  This gives us a reasonable chance of coming close to where the user will want
  3382. *      an object that is being added to a pre-converted screen.
  3383. *
  3384. *!*****************************************************************************
  3385. *!
  3386. *!      Procedure: FINDLIKEVPOS
  3387. *!
  3388. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3389. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3390. *!
  3391. *!          Calls: ISOBJECT()         (function  in TRANSPRT.PRG)
  3392. *!
  3393. *!*****************************************************************************
  3394. PROCEDURE findlikevpos
  3395. PARAMETER m.oldvpos
  3396. PRIVATE m.objid, m.saverec, m.retval
  3397. m.saverec = RECNO()
  3398. m.retval = m.oldvpos
  3399.  
  3400. LOCATE FOR platform = m.g_fromplatform AND vpos = m.oldvpos AND INLIST(objtype,C_OBJTYPELIST)
  3401. IF FOUND()
  3402.    m.objid = uniqueid
  3403.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  3404.    IF FOUND()
  3405.       m.retval = vpos
  3406.    ENDIF
  3407. ENDIF
  3408.  
  3409. GOTO RECORD (m.saverec)
  3410. RETURN m.retval
  3411.  
  3412. *
  3413. * FindLikeHpos - Tries to find an object in the from platform with an hpos that matches the hpos
  3414. *      of a new object we are adding.  If it finds one, we return that objects Hpos in the to
  3415. *      platform.  This gives us a reasonable chance of coming close to where the user will want
  3416. *      an object that is being added to a pre-converted screen.
  3417. *
  3418. *!*****************************************************************************
  3419. *!
  3420. *!      Procedure: FINDLIKEHPOS
  3421. *!
  3422. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3423. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3424. *!
  3425. *!          Calls: ISOBJECT()         (function  in TRANSPRT.PRG)
  3426. *!
  3427. *!*****************************************************************************
  3428. PROCEDURE findlikehpos
  3429. PARAMETER m.oldhpos
  3430. PRIVATE m.objid, m.saverec, m.retval
  3431. m.saverec = RECNO()
  3432. m.retval = m.oldhpos
  3433.  
  3434. LOCATE FOR platform = m.g_fromplatform AND hpos = m.oldhpos AND INLIST(objtype,C_OBJTYPELIST)
  3435. IF FOUND()
  3436.    m.objid = uniqueid
  3437.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  3438.    IF FOUND()
  3439.       m.retval = hpos
  3440.    ENDIF
  3441. ENDIF
  3442.  
  3443. GOTO RECORD (m.saverec)
  3444. RETURN m.retval
  3445.  
  3446. *
  3447. * MakeCharFit - Makes sure that a report or screen is large enough to hold all of its objects.
  3448. *
  3449. *!*****************************************************************************
  3450. *!
  3451. *!      Procedure: MAKECHARFIT
  3452. *!
  3453. *!      Called by: NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3454. *!               : ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3455. *!
  3456. *!          Calls: GETRIGHTMOST       (procedure in TRANSPRT.PRG)
  3457. *!               : GETLOWEST          (procedure in TRANSPRT.PRG)
  3458. *!
  3459. *!*****************************************************************************
  3460. PROCEDURE makecharfit
  3461. PRIVATE m.right, m.bottom
  3462.  
  3463. m.right = CEILING(getrightmost(m.g_toplatform))+2
  3464. m.bottom = CEILING(getlowest(m.g_toplatform))+2
  3465.  
  3466. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  3467. IF FOUND()
  3468.    IF WIDTH < m.right
  3469.       REPLACE WIDTH WITH m.right
  3470.    ENDIF
  3471.  
  3472.    IF height < m.bottom AND m.g_filetype = c_screen
  3473.       REPLACE height WITH m.bottom
  3474.    ENDIF
  3475. ENDIF
  3476. RETURN
  3477.  
  3478. *
  3479. * allenvirons - Process all the screen and environment records first.
  3480. *
  3481. *!*****************************************************************************
  3482. *!
  3483. *!      Procedure: ALLENVIRONS
  3484. *!
  3485. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3486. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3487. *!
  3488. *!          Calls: ADJCOLOR           (procedure in TRANSPRT.PRG)
  3489. *!               : ADJOBJCODE         (procedure in TRANSPRT.PRG)
  3490. *!               : ADJFONT            (procedure in TRANSPRT.PRG)
  3491. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  3492. *!
  3493. *!*****************************************************************************
  3494. PROCEDURE allenvirons
  3495. PRIVATE m.recno
  3496.  
  3497. SCAN FOR platform = m.g_fromplatform AND !DELETED() AND ;
  3498.       (objtype = c_otheader OR objtype = c_otrel OR objtype = c_otworkar OR objtype = c_otindex OR ;
  3499.       (m.g_filetype = c_label AND objtype = c_ot20label))
  3500.    m.recno = RECNO()
  3501.  
  3502.    DO fixpen
  3503.  
  3504.    SCATTER MEMVAR MEMO
  3505.    APPEND BLANK
  3506.    GATHER MEMVAR MEMO
  3507.  
  3508.    REPLACE platform WITH m.g_toplatform
  3509.    IF IsEnviron(objtype) AND m.g_grph2char
  3510.       * DOS requires the alias name to be in upper case, while Windows doesn't
  3511.       REPLACE TAG WITH UPPER(TAG)
  3512.       REPLACE tag2 WITH UPPER(tag2)
  3513.    ENDIF
  3514.  
  3515.    IF objtype = c_otheader OR (m.g_filetype = c_label AND objtype = c_ot20label)
  3516.       m.g_windheight = HEIGHT
  3517.       m.g_windwidth = WIDTH
  3518.  
  3519.       DO CASE
  3520.       CASE m.g_filetype = c_screen
  3521.          DO adjcolor
  3522.  
  3523.       CASE m.g_filetype = c_report
  3524.          DO CASE
  3525.          CASE m.g_char2grph
  3526.             REPLACE vpos WITH 1,;
  3527.              WIDTH WITH -1.0,;
  3528.              ruler WITH 1,;
  3529.              rulerlines WITH 1,;
  3530.              gridv WITH 9,;
  3531.              gridh WITH 9,;
  3532.              penred   WITH 60,;
  3533.              pengreen WITH 80,;
  3534.              penblue    WITH 0
  3535.          CASE m.g_grph2char
  3536.             REPLACE height WITH c_charrptheight
  3537.             REPLACE WIDTH WITH c_charrptwidth
  3538.          ENDCASE
  3539.  
  3540.       CASE m.g_filetype = c_label
  3541.          DO CASE
  3542.          CASE m.g_char2grph
  3543.             REPLACE objtype WITH c_otheader,;
  3544.              ruler WITH 1,;
  3545.              rulerlines WITH 1,;
  3546.              grid WITH .T.,;
  3547.              gridv WITH 12,;
  3548.              gridh WITH 12,;
  3549.              penred   WITH -1,;
  3550.              pengreen WITH 65535,;
  3551.              stretchtop WITH .F.,;
  3552.              TOP WITH .F.,;
  3553.              BOTTOM WITH .T.,;
  3554.              curpos WITH .F.
  3555.          CASE m.g_grph2char
  3556.             REPLACE objtype WITH c_ot20label
  3557.             REPLACE hpos WITH (hpos * c_charsperinch)/10000
  3558.             REPLACE height WITH (height * c_linesperinch)/10000
  3559.             REPLACE WIDTH WITH (WIDTH * c_charsperinch)/10000
  3560.             IF WIDTH < 0
  3561.                REPLACE WIDTH WITH c_charrptwidth
  3562.             ENDIF
  3563.          ENDCASE
  3564.       ENDCASE
  3565.  
  3566.       DO adjobjcode
  3567.       DO adjfont
  3568.    ENDIF
  3569.  
  3570.    GOTO RECORD m.recno
  3571. ENDSCAN
  3572. m.g_mercury = MIN(m.g_mercury + 5, 95)
  3573. DO updtherm WITH m.g_mercury
  3574. RETURN
  3575.  
  3576. *
  3577. * allothers - Process all other records.
  3578. *
  3579. *!*****************************************************************************
  3580. *!
  3581. *!      Procedure: ALLOTHERS
  3582. *!
  3583. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3584. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3585. *!
  3586. *!          Calls: CALCPOSITIONS      (procedure in TRANSPRT.PRG)
  3587. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3588. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  3589. *!
  3590. *!*****************************************************************************
  3591. PROCEDURE allothers
  3592. PARAMETER m.thermpart
  3593. PRIVATE m.recno, m.numothers, m.thermstep, m.i
  3594.  
  3595. m.thermstep = m.thermpart / m.objindex
  3596.  
  3597. SELECT (m.g_fromobjonlyalias)
  3598. SET RELATION TO recnum INTO m.g_scrnalias ADDITIVE
  3599. LOCATE FOR .T.
  3600. m.i = 1
  3601.  
  3602. SCAN FOR !DELETED()
  3603.  
  3604.    m.recno = RECNO()
  3605.  
  3606.    DO fixpen
  3607.  
  3608.    SCATTER MEMVAR MEMO
  3609.  
  3610.    IF m.g_char2grph
  3611.       DO calcpositions WITH m.i    && determine relative positions of objects
  3612.       m.i = m.i + 1
  3613.    ENDIF
  3614.  
  3615.    SELECT (m.g_scrnalias)
  3616.    APPEND BLANK
  3617.    GATHER MEMVAR MEMO
  3618.  
  3619.    IF gError
  3620.      *- seems to be necessary (jd 3/24/96)
  3621.      RETURN TO MASTER
  3622.    ENDIF
  3623.  
  3624.    REPLACE platform WITH m.g_toplatform
  3625.  
  3626.    DO fillininfo
  3627.  
  3628.    SELECT (m.g_fromobjonlyalias)
  3629.    GOTO RECORD m.recno
  3630.  
  3631.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  3632.    DO updtherm WITH m.g_mercury
  3633.  
  3634. ENDSCAN
  3635. RETURN
  3636.  
  3637. *
  3638. * FillInInfo - Fill in information for the fields in SCX/FRX database.
  3639. *
  3640. *!*****************************************************************************
  3641. *!
  3642. *!      Procedure: FILLININFO
  3643. *!
  3644. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3645. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3646. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  3647. *!
  3648. *!          Calls: ADJRPTSUPPRESS     (procedure in TRANSPRT.PRG)
  3649. *!               : ADJRPTFLOAT        (procedure in TRANSPRT.PRG)
  3650. *!               : ADJRPTRESET        (procedure in TRANSPRT.PRG)
  3651. *!               : OBJ2BASEFONT()     (function  in TRANSPRT.PRG)
  3652. *!               : num2style()        (function  in TRANSPRT.PRG)
  3653. *!               : ADJPEN             (procedure in TRANSPRT.PRG)
  3654. *!               : ADJCOLOR           (procedure in TRANSPRT.PRG)
  3655. *!               : ADJFONT            (procedure in TRANSPRT.PRG)
  3656. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  3657. *!
  3658. *!*****************************************************************************
  3659. PROCEDURE fillininfo
  3660. IF m.g_filetype = c_report
  3661.    DO adjrptsuppress
  3662.    DO adjrptfloat
  3663. ENDIF
  3664.  
  3665. DO CASE
  3666. CASE m.g_char2grph
  3667.    * Handle 2D or 3D decision
  3668.    IF _MAC ;
  3669.          AND (INLIST(objtype, c_ottxtbut, c_otradbut, c_otchkbox, ;
  3670.              c_otspinner, c_otlist, c_otpopup) ;
  3671.           OR (objtype = c_otfield AND INLIST(objcode,c_sgget,c_sgedit)))
  3672.       * Applies to most objects and GET/EDIT fields (but not SAY fields)
  3673.       IF m.g_look2d
  3674.          * Add '2' to the control string
  3675.          REPLACE picture WITH addquote(make2d(picture))
  3676.       ELSE
  3677.          REPLACE picture WITH addquote(make3d(picture))
  3678.       ENDIF
  3679.    ENDIF
  3680.  
  3681.    DO CASE
  3682.    CASE objtype = c_otpopup
  3683.       * Popups are a special case since the arrow control counts against the width
  3684.       * under Windows.
  3685.       REPLACE WIDTH WITH WIDTH + 2
  3686.    CASE INLIST(objtype,c_otrepvar,c_otrepfld)
  3687.       DO adjrptreset
  3688.       IF fillchar = "N"
  3689.          REPLACE offset WITH 1      && Change alignment for numerics.
  3690.       ENDIF
  3691.    ENDCASE
  3692. CASE m.g_grph2char
  3693.    DO CASE
  3694.    CASE objtype = c_ottext
  3695.       REPLACE height WITH MAX(height,1), width WITH MAX(width,1)
  3696.    CASE objtype = c_otspinner
  3697.       * Map spinners to regular fields
  3698.       REPLACE objtype   WITH c_otfield, ;
  3699.          height    WITH 1, ;
  3700.          fillchar  WITH "N"
  3701.    CASE objtype = c_otline
  3702.       * Map Windows lines to DOS boxes
  3703.       REPLACE objtype WITH c_otbox
  3704.       REPLACE height  WITH MAX(height,1), WIDTH WITH MAX(WIDTH,1)
  3705.       IF pensize >= 6
  3706.          REPLACE boxchar WITH "█"
  3707.       ENDIF
  3708.    CASE INLIST(objtype,c_otradbut,c_ottxtbut)
  3709.       * Remove the BMP extension from bitmap buttons
  3710.       REPLACE PICTURE WITH STRTRAN(PICTURE,".BMP","")
  3711.       REPLACE PICTURE WITH STRTRAN(PICTURE,".bmp","")
  3712.    CASE objtype = c_otfield AND ;
  3713.          (objcode = c_sgedit  OR (INLIST(objcode,c_sgsay,c_sgget) AND WIDTH > 25))
  3714.       * Adjust widths of edit fields and very long GET/SAY fields to account
  3715.       * for font differences between the object and the base font.
  3716.       REPLACE WIDTH WITH MAX(obj2basefont(WIDTH,g_dfltfface,g_dfltfsize,g_dfltfstyle,;
  3717.          fontface,fontsize,num2style(fontstyle)),1)
  3718.    CASE objtype = c_otbox AND (objcode = 4)
  3719.       IF pensize >= 6
  3720.          REPLACE boxchar WITH "█"
  3721.       ENDIF
  3722.    CASE INLIST(objtype,c_otrepvar,c_otrepfld)
  3723.       DO adjrptreset
  3724.       IF objtype = c_otrepvar
  3725.          * DOS report variable names have to be in upper case
  3726.          REPLACE name WITH UPPER(name)
  3727.       ENDIF
  3728.    ENDCASE
  3729. CASE m.g_grph2grph
  3730.    * Handle 2D or 3D decision
  3731.    IF _MAC ;
  3732.          AND (INLIST(objtype, c_ottxtbut, c_otradbut, c_otchkbox, ;
  3733.              c_otspinner, c_otlist, c_otpopup) ;
  3734.           OR (objtype = c_otfield AND INLIST(objcode,c_sgget,c_sgedit)))
  3735.       * Applies to most objects and GET/EDIT fields (but not SAY fields)
  3736.       IF m.g_look2d
  3737.          * Add '2' to the control string
  3738.          REPLACE picture WITH addquote(make2d(picture))
  3739.       ELSE
  3740.          REPLACE picture WITH addquote(make3d(picture))
  3741.       ENDIF
  3742.    ENDIF
  3743.  
  3744.    DO CASE
  3745.    CASE objtype = c_ottxtbut
  3746.       * Preserve default button height across transportation sessions
  3747.       DO CASE
  3748.       CASE  _MAC AND height = m.g_winbtnheight
  3749.          REPLACE height WITH m.g_macbtnheight
  3750.       CASE  _WINDOWS AND INLIST(height,1.500,1.125,m.g_macbtnheight)
  3751.          * The Mac button might have been either 2D or 3D
  3752.          REPLACE height WITH m.g_winbtnheight
  3753.       ENDCASE
  3754.    CASE objtype = c_otpopup
  3755.       REPLACE height WITH m.g_pophght
  3756.    ENDCASE
  3757.  
  3758.     * Map Mac 3D lines/boxes back to Windows single line lines/boxes
  3759.     IF _WINDOWS AND INLIST(objtype,c_otbox,c_otline)
  3760.        IF pensize = 2 AND penpat = 100
  3761.            REPLACE pensize WITH 1, penpat WITH 8
  3762.         ENDIF
  3763.     ENDIF
  3764.  
  3765. ENDCASE
  3766.  
  3767. IF objtype <> c_otbox AND objtype <> c_otline
  3768.    DO adjpen
  3769. ENDIF
  3770.  
  3771. DO adjcolor
  3772. DO adjfont
  3773. IF m.g_filetype = c_screen
  3774.    DO adjheightandwidth
  3775. ENDIF
  3776. RETURN
  3777.  
  3778. *
  3779. * adjrptfloat - Convert float/stretch/relative postion types between
  3780. *      character and graphical positions
  3781. *
  3782. *!*****************************************************************************
  3783. *!
  3784. *!      Procedure: ADJRPTFLOAT
  3785. *!
  3786. *!      Called by: UPDATEREPORT       (procedure in TRANSPRT.PRG)
  3787. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3788. *!
  3789. *!*****************************************************************************
  3790. PROCEDURE adjrptfloat
  3791. DO CASE
  3792. CASE m.g_char2grph
  3793.    DO CASE
  3794.    CASE FLOAT AND (objtype = c_otbox AND HEIGHT > 1)
  3795.       * Box or a vertical line--float as band stretches translates to Top--stretch w/ band.
  3796.       * Use the height > 1 test because DOS boxes haven't been translated into Windows
  3797.       * lines yet.
  3798.       REPLACE stretchtop WITH .T.
  3799.       REPLACE TOP WITH .F.
  3800.       REPLACE BOTTOM WITH .F.
  3801.    CASE FLOAT AND STRETCH
  3802.       REPLACE stretchtop WITH .T.
  3803.       REPLACE TOP WITH .F.
  3804.       REPLACE BOTTOM WITH .F.
  3805.    CASE FLOAT
  3806.       REPLACE BOTTOM WITH .T.
  3807.       REPLACE TOP WITH .F.
  3808.       REPLACE stretchtop WITH .F.
  3809.    ENDCASE
  3810. CASE m.g_grph2char
  3811.    DO CASE
  3812.    CASE objtype = c_otrepfld AND (stretchtop OR STRETCH)
  3813.       REPLACE FLOAT WITH .T.
  3814.       REPLACE STRETCH WITH .T.
  3815.    CASE BOTTOM
  3816.       REPLACE FLOAT WITH .T.
  3817.       REPLACE STRETCH WITH .F.
  3818.    CASE TOP
  3819.       REPLACE FLOAT WITH .F.
  3820.       REPLACE STRETCH WITH .F.
  3821.    CASE stretchtop OR STRETCH
  3822.       REPLACE FLOAT WITH .T.
  3823.       REPLACE STRETCH WITH .F.
  3824.    ENDCASE
  3825. ENDCASE
  3826. RETURN
  3827.  
  3828. *
  3829. * adjrptSuppress - Convert Suppression types between 2.5 platforms.
  3830. *
  3831. *!*****************************************************************************
  3832. *!
  3833. *!      Procedure: ADJRPTSUPPRESS
  3834. *!
  3835. *!      Called by: UPDATEREPORT       (procedure in TRANSPRT.PRG)
  3836. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3837. *!
  3838. *!*****************************************************************************
  3839. PROCEDURE adjrptsuppress
  3840. * Handle suppression of repeated values.
  3841. *
  3842. * In DOS 2.0, the value of the detail record "norepeat" determines whether repeated values
  3843. * are suppressed, if this is a field object, or whether group headings are repeated,
  3844. * if this is a group header.  The main screen header record "norepeat" field determines
  3845. * whether blank lines are suppressed in the detail band.
  3846. *
  3847. * In 2.5, the norepeat field is used just for suppression of blank lines.
  3848. * We are positioned on a detail record now.
  3849. *
  3850. DO CASE
  3851. CASE m.g_char2grph
  3852.    IF objtype = c_otband
  3853.       * The meaning for DOS is reversed from Windows
  3854.       REPLACE norepeat WITH !norepeat
  3855.    ELSE
  3856.       IF norepeat            && suppress repeated values
  3857.          REPLACE supvalchng WITH .T.
  3858.          REPLACE supovflow WITH .F.
  3859.          DO CASE
  3860.          CASE resetrpt = 0
  3861.             REPLACE suprpcol WITH 0
  3862.             REPLACE supgroup WITH 0
  3863.          CASE resetrpt = 1
  3864.             REPLACE suprpcol WITH 3
  3865.             REPLACE supgroup WITH 0
  3866.          OTHERWISE
  3867.             REPLACE suprpcol WITH 0
  3868.             REPLACE supgroup WITH resetrpt+3
  3869.          ENDCASE
  3870.       ELSE                   && no suppression of repeated values
  3871.          REPLACE supalways WITH .T.
  3872.          REPLACE supvalchng WITH .F.
  3873.          REPLACE supovflow WITH .F.
  3874.          REPLACE suprpcol WITH 3
  3875.          REPLACE supgroup WITH 0
  3876.       ENDIF
  3877.    ENDIF
  3878. CASE m.g_grph2char
  3879.    IF supvalchng AND !supalways
  3880.       REPLACE norepeat WITH .T.
  3881.       IF supgroup > 0
  3882.          REPLACE resetrpt WITH supgroup - 3
  3883.       ELSE
  3884.          IF suprpcol = 3
  3885.             REPLACE resetrpt WITH 1
  3886.          ELSE
  3887.             REPLACE resetrpt WITH 0
  3888.          ENDIF
  3889.       ENDIF
  3890.    ELSE
  3891.       REPLACE norepeat WITH .F.
  3892.    ENDIF
  3893. ENDCASE
  3894. RETURN
  3895.  
  3896. *
  3897. * adjrptreset - Convert the reset values between 2.0 and 2.5.
  3898. *
  3899. *!*****************************************************************************
  3900. *!
  3901. *!      Procedure: ADJRPTRESET
  3902. *!
  3903. *!      Called by: UPDATEREPORT       (procedure in TRANSPRT.PRG)
  3904. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3905. *!
  3906. *!*****************************************************************************
  3907. PROCEDURE adjrptreset
  3908. DO CASE
  3909. CASE m.g_char2grph
  3910.    DO CASE
  3911.    CASE resettotal = 0
  3912.       REPLACE resettotal WITH 1
  3913.    CASE resettotal = 1
  3914.       REPLACE resettotal WITH 2
  3915.    OTHERWISE
  3916.       REPLACE resettotal WITH resettotal+3
  3917.    ENDCASE
  3918. CASE m.g_grph2char
  3919.    DO CASE
  3920.    CASE resettotal = 1
  3921.       REPLACE resettotal WITH 0
  3922.    CASE resettotal = 2 OR resettotal = 3
  3923.       REPLACE resettotal WITH 1
  3924.    OTHERWISE
  3925.       REPLACE resettotal WITH resettotal-3
  3926.    ENDCASE
  3927. ENDCASE
  3928. RETURN
  3929.  
  3930. *
  3931. * GetCharSuppress - Gets the global setting of blank line Suppression for a report. (This is
  3932. *      only valid for character mode reports).
  3933. *
  3934. *!*****************************************************************************
  3935. *!
  3936. *!       Function: GETCHARSUPPRESS
  3937. *!
  3938. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  3939. *!
  3940. *!*****************************************************************************
  3941. FUNCTION getcharsuppress
  3942. LOCATE FOR platform = m.g_fromplatform AND objtype = c_otheader
  3943. IF FOUND()
  3944.    RETURN norepeat
  3945. ELSE
  3946.    RETURN .F.
  3947. ENDIF
  3948.  
  3949. *
  3950. * SuppressBlankLines - Looks through the from platform to see if any
  3951. *      object is marked to Suppress blank lines.  If one is, we
  3952. *      make the entire "to" report (which is assumed to be character)
  3953. *      Suppress blank lines.
  3954. *
  3955. *!*****************************************************************************
  3956. *!
  3957. *!      Procedure: SUPPRESSBLANKLINES
  3958. *!
  3959. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3960. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3961. *!
  3962. *!          Calls: GETBANDCODE()      (function  in TRANSPRT.PRG)
  3963. *!
  3964. *!*****************************************************************************
  3965. PROCEDURE suppressblanklines
  3966. PRIVATE m.supcount
  3967. DO CASE
  3968. CASE m.g_grph2char
  3969.    COUNT TO m.supcount FOR platform = m.g_fromplatform AND objtype = c_otrepfld
  3970.    IF m.supcount > 0
  3971.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  3972.       IF FOUND()
  3973.          REPLACE norepeat WITH .T.
  3974.       ENDIF
  3975.    ENDIF
  3976. CASE m.g_char2grph
  3977.    * DOS suppression of blank lines only applies to detail lines.  Only mark graphical
  3978.    * objects in the detail band as suppressed.
  3979.    SCAN FOR platform = m.g_toplatform AND objtype <> c_otband AND objtype <> c_otheader
  3980.       myexpr = expr
  3981.       IF objtype = 8
  3982.          WAIT CLEAR
  3983.       ENDIF
  3984.       bcode  = getbandcode(vpos)
  3985.       IF bcode = 4     && detail band
  3986.          REPLACE norepeat WITH m.g_norepeat
  3987.       ELSE
  3988.          REPLACE norepeat WITH .F.
  3989.       ENDIF
  3990.    ENDSCAN
  3991. ENDCASE
  3992.  
  3993. *
  3994. * allGroups - Process all Group records.
  3995. *
  3996. *!*****************************************************************************
  3997. *!
  3998. *!      Procedure: ALLGROUPS
  3999. *!
  4000. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4001. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4002. *!
  4003. *!          Calls: UPDTHERM           (procedure in TRANSPRT.PRG)
  4004. *!
  4005. *!*****************************************************************************
  4006. PROCEDURE allgroups
  4007. PARAMETER m.thermpart
  4008. PRIVATE m.recno, m.numothers, m.thermstep
  4009.  
  4010. m.thermstep = m.thermpart / m.objindex
  4011. SELECT (m.g_scrnalias)
  4012.  
  4013. SCAN FOR platform = m.g_fromplatform AND objtype = c_otgroup
  4014.    m.recno = RECNO()
  4015.  
  4016.    SCATTER MEMVAR MEMO
  4017.    APPEND BLANK
  4018.    GATHER MEMVAR MEMO
  4019.  
  4020.    REPLACE platform WITH m.g_toplatform
  4021.  
  4022.    GOTO RECORD m.recno
  4023.  
  4024.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  4025.    DO updtherm WITH m.g_mercury
  4026. ENDSCAN
  4027.  
  4028. *
  4029. * RptConvert - Converts entire reports between platforms.
  4030. *
  4031. *!*****************************************************************************
  4032. *!
  4033. *!      Procedure: RPTCONVERT
  4034. *!
  4035. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4036. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4037. *!
  4038. *!          Calls: ISREPTOBJECT()     (function  in TRANSPRT.PRG)
  4039. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4040. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  4041. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  4042. *!               : CLONEBAND          (procedure in TRANSPRT.PRG)
  4043. *!
  4044. *!*****************************************************************************
  4045. PROCEDURE rptconvert
  4046. PRIVATE m.thermstep
  4047.  
  4048. COUNT TO m.thermstep FOR platform = m.g_toplatform AND ;
  4049.    (isreptobject(objtype) OR objtype = c_otband)
  4050.  
  4051. IF m.g_grph2char
  4052.    m.thermstep = 25 / m.thermstep
  4053. ELSE
  4054.    m.thermstep = 50 / m.thermstep
  4055. ENDIF
  4056.  
  4057. * We need to do bands before any other object.
  4058. SCAN FOR platform = m.g_toplatform AND objtype = c_otband
  4059.    DO rptobjconvert WITH 0
  4060.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  4061.    DO updtherm WITH m.g_mercury
  4062. ENDSCAN
  4063.  
  4064. * We need to know where bands start and where they end in
  4065. * both platforms.
  4066. COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  4067. GOTO TOP
  4068.  
  4069. DIMENSION bands[m.bandCount,4]
  4070. m.bandcount = bandinfo()
  4071.  
  4072. * Make sure that the band headers and footers match on Windows
  4073. IF m.g_char2grph
  4074.    DO cloneband
  4075. ENDIF
  4076.  
  4077. SCAN FOR platform = m.g_toplatform ;
  4078.    AND INLIST(objtype, c_otrepfld, c_ottext,c_otbox, c_otline, c_otpicture)
  4079.  
  4080.    IF m.g_grph2grph OR objtype <> c_otpicture
  4081.        DO rptobjconvert WITH m.bandcount
  4082.    ENDIF
  4083.  
  4084.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  4085.    DO updtherm WITH m.g_mercury
  4086. ENDSCAN
  4087.  
  4088. *
  4089. * RptObjConvert - Converts the size and postion of a given record in a report/label
  4090. *
  4091. *!*****************************************************************************
  4092. *!
  4093. *!      Procedure: RPTOBJCONVERT
  4094. *!
  4095. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4096. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4097. *!               : NEWBANDS           (procedure in TRANSPRT.PRG)
  4098. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  4099. *!
  4100. *!          Calls: EMPTYBAND()        (function  in TRANSPRT.PRG)
  4101. *!               : CVTREPORTVERTICAL()(function  in TRANSPRT.PRG)
  4102. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  4103. *!               : ADJCOLOR           (procedure in TRANSPRT.PRG)
  4104. *!               : ADJFONT            (procedure in TRANSPRT.PRG)
  4105. *!               : GETBANDINDEX       (procedure in TRANSPRT.PRG)
  4106. *!               : CVTREPORTHORIZONTAL(function  in TRANSPRT.PRG)
  4107. *!               : CVTRPTLINES()      (function  in TRANSPRT.PRG)
  4108. *!               : ADJTEXT            (procedure in TRANSPRT.PRG)
  4109. *!
  4110. *!*****************************************************************************
  4111. PROCEDURE rptobjconvert
  4112. PARAMETER m.bandcount
  4113. PRIVATE m.bandindex, m.endindex, m.posinband, m.saverec, m.objid, m.origvpos, m.lineheight
  4114.  
  4115. IF m.g_grph2grph
  4116.    DO grphrptcvt    && map Mac and Windows coordinates
  4117.     IF _MAC AND !m.g_newobjmode
  4118.        * We've already lined up all the Mac objects.
  4119.        RETURN
  4120.    ENDIF
  4121. ENDIF
  4122.  
  4123. DO CASE
  4124. CASE objtype = c_otband
  4125.    * Map height and width of band to proper values
  4126.  
  4127.    DO CASE
  4128.    CASE m.g_char2grph AND emptyband(uniqueid)
  4129.       REPLACE height WITH 0
  4130.    CASE m.g_grph2grph
  4131.       * No conversion necessary.
  4132.    OTHERWISE
  4133.       m.lineheight = cvtreportvertical(HEIGHT)
  4134.       IF m.g_grph2char AND BETWEEN(m.lineheight,1.00,1.10) AND objcode = 4
  4135.          * This is a heuristic rule to make quick reports and other reports with
  4136.          * a single-line detail band transport to DOS correctly.  Sometimes the bands
  4137.          * will be just a little larger than one line in Windows.
  4138.          REPLACE height WITH 1
  4139.       ELSE
  4140.          REPLACE height WITH CEILING(m.lineheight)
  4141.       ENDIF
  4142.    ENDCASE
  4143.  
  4144.    DO CASE
  4145.    CASE m.g_char2grph
  4146.       * Map DOS offset field to Windows "if lines less than".  These fields control
  4147.       * when the data grouping decides to start a new page.  This data is stored in "width".
  4148.       REPLACE WIDTH WITH 10000 * offset / c_linesperinch
  4149.    CASE m.g_grph2char
  4150.       REPLACE height WITH MAX(1, height)
  4151.       REPLACE offset WITH ROUND(WIDTH/10000, 0) * c_linesperinch
  4152.    ENDCASE
  4153. OTHERWISE
  4154.    * Converting a regular object such as a field or line.
  4155.    m.origvpos   = vpos
  4156.    m.origheight = height
  4157.  
  4158.    IF m.g_char2grph AND objtype = c_otbox
  4159.       DO adjbox WITH 0
  4160.       DO adjcolor
  4161.       DO adjfont
  4162.    ENDIF
  4163.  
  4164.    * Find which band in the "from" platform this object came from
  4165.    * Use a vpos expressed in "from" units for this function.
  4166.    m.bandindex = getbandindex(m.origvpos, m.bandcount)
  4167.  
  4168.    * Since keeping objects in the proper bands is our highest
  4169.    * priority, we calculate the new Vpos by determining how many
  4170.    * lines into its band an object lies and adding this
  4171.    * value (converted) to that band's Vpos in the from platform.
  4172.    m.posinband = MAX(cvtreportvertical((vpos - bands[m.bandIndex, c_fmbandvpos])),0)
  4173.    REPLACE vpos WITH bands[m.bandIndex, c_tobandvpos] + m.posinband
  4174.  
  4175.    * Since vertical lines and boxes can stretch across bands, we need to
  4176.    * watch their ending positions.
  4177.    IF (objtype = c_otbox AND cvtreportvertical(height) > 1) ;
  4178.          OR (objtype = c_otline AND WIDTH < height)
  4179.       m.endindex = getbandindex(IIF(m.g_char2grph,m.origvpos+m.origheight-1,;
  4180.          m.origvpos + m.origheight), m.bandcount)
  4181.       IF m.endindex <> m.bandindex
  4182.          *m.endinband = IIF(m.g_char2grph, m.origvpos+m.origheight-.25, m.origvpos+m.origheight) ;
  4183.          *   - bands[m.endIndex, c_fmbandvpos]
  4184.          m.endinband = m.origvpos+m.origheight - bands[m.endIndex, c_fmbandvpos]
  4185.          IF m.g_char2grph
  4186.             * Allow for the fact that box characters in DOS appear in the middle of
  4187.             * the line, but always stick out into the "end" band a little bit.
  4188.             m.endinband = MAX(m.endinband - 0.5,0.25)
  4189.          ENDIF
  4190.          m.endinband = cvtreportvertical(m.endinband)
  4191.          REPLACE height WITH bands[m.endIndex, c_tobandvpos] + m.endinband - vpos
  4192.       ELSE
  4193.          REPLACE height WITH cvtreportvertical(HEIGHT)
  4194.       ENDIF
  4195.    ELSE
  4196.       REPLACE height WITH cvtreportvertical(height)
  4197.    ENDIF
  4198.  
  4199.    REPLACE hpos WITH cvtreporthorizontal(hpos)
  4200.    REPLACE WIDTH WITH cvtreporthorizontal(WIDTH)
  4201.    DO CASE
  4202.    CASE m.g_char2grph
  4203.       IF objtype = c_otline AND WIDTH > height
  4204.          * Handle horizontal lines separately.  They are very sensitive to line
  4205.          * height.
  4206.          REPLACE height WITH cvtrptlines(height)
  4207.       ENDIF
  4208.    CASE m.g_grph2char
  4209.       IF objtype = c_otbox AND ROUND(height,0) <> 1
  4210.          DO adjbox WITH 0
  4211.       ENDIF
  4212.  
  4213.       REPLACE vpos WITH ROUND(vpos,0)
  4214.       REPLACE hpos WITH ROUND(hpos,0)
  4215.       REPLACE height WITH ROUND(height,0)
  4216.       REPLACE WIDTH WITH ROUND(WIDTH,0)
  4217.  
  4218.       * Make sure that this object will not extend past the end of the last
  4219.       * band, which leads to "invalid report" errors on DOS.
  4220.       IF m.bandindex = m.bandcount AND ;
  4221.             (vpos + height ;
  4222.             > bands[m.bandIndex,c_tobandvpos] ;
  4223.             + bands[m.bandIndex,c_tobandheight])
  4224.          * Can we move the object up so that it fits?
  4225.          IF height <= bands[m.bandIndex, c_tobandheight]
  4226.             * It will fit if we scootch it up a little.
  4227.             REPLACE vpos WITH vpos -;
  4228.                (bands[m.bandIndex,c_tobandheight] - height)
  4229.          ELSE
  4230.             * No room for it at all.  Crop the height.  Make as much fit as possible.
  4231.             REPLACE vpos   WITH bands[m.bandIndex,c_tobandvpos]
  4232.             REPLACE height WITH bands[m.bandIndex,c_tobandheight]
  4233.          ENDIF
  4234.       ENDIF
  4235.  
  4236.       DO CASE
  4237.       CASE objtype = c_ottext
  4238.          REPLACE height WITH 1
  4239.          DO adjtext WITH WIDTH
  4240.          REPLACE WIDTH WITH LEN(expr)-2
  4241.  
  4242.       CASE objtype = c_otrepfld AND height < 1
  4243.          REPLACE height WITH 1
  4244.  
  4245.       ENDCASE
  4246.       IF ROUND(hpos,0) = -1
  4247.          REPLACE hpos WITH 0
  4248.       ENDIF
  4249.    ENDCASE
  4250.  
  4251.    * Guarantee that we are in the right band.
  4252.    IF vpos > bands[m.bandIndex,c_tobandvpos] ;
  4253.          + bands[m.bandIndex,c_tobandheight] - 1
  4254.       REPLACE vpos WITH bands[m.bandIndex,c_tobandvpos] ;
  4255.          + bands[m.bandIndex,c_tobandheight] - 1
  4256.    ENDIF
  4257.  
  4258.    IF vpos < 0
  4259.       REPLACE vpos WITH 0
  4260.    ENDIF
  4261. ENDCASE
  4262.  
  4263. IF height <= 0
  4264.    REPLACE height WITH 1
  4265. ENDIF
  4266.  
  4267. RETURN
  4268.  
  4269. *
  4270. * GetBandIndex - Given a Vpos (from platform), this function returns the
  4271. *      index in the Band array of the band which this Vpos lies in.
  4272. *
  4273. *!*****************************************************************************
  4274. *!
  4275. *!      Procedure: GETBANDINDEX
  4276. *!
  4277. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4278. *!
  4279. *!*****************************************************************************
  4280. PROCEDURE getbandindex
  4281. PARAMETER m.vpos, m.bandcount
  4282. PRIVATE m.loop
  4283. FOR m.loop = 1 TO m.bandcount
  4284.    IF m.vpos >= bands[m.loop,c_fmbandvpos] ;
  4285.          AND m.vpos < bands[m.loop,c_fmbandvpos]+bands[m.loop,c_fmbandheight]
  4286.       RETURN m.loop
  4287.    ENDIF
  4288. ENDFOR
  4289. RETURN m.bandcount    && drop them into the bottom band as a default
  4290.  
  4291. *
  4292. * BandInfo - Fills a predefined array named Band as follows.
  4293. *   bands[1] = Start Position in To platform.
  4294. *   bands[2] = Height in To platform.
  4295. *   bands[3] = Start Position in From platform.
  4296. *   bands[4] = Height in From platform.
  4297. *
  4298. *!*****************************************************************************
  4299. *!
  4300. *!       Function: BANDINFO
  4301. *!
  4302. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4303. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4304. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  4305. *!
  4306. *!          Calls: RESIZEBAND         (procedure in TRANSPRT.PRG)
  4307. *!
  4308. *!*****************************************************************************
  4309. FUNCTION bandinfo
  4310. PRIVATE m.saverec, m.bandcount, m.loop, ;
  4311.    m.pagefooter, m.pageheader, m.colheader, m.colfooter, ;
  4312.    m.toposition, m.fromposition, m.objcode, m.expr
  4313.  
  4314. m.toposition   = 0
  4315. m.fromposition = 0
  4316. m.bandcount    = 0
  4317. m.colheader    = 0
  4318. m.colfooter    = 0
  4319. m.pageheader   = 0
  4320. m.pagefooter   = 0
  4321.  
  4322. SCAN FOR platform = m.g_toplatform AND objtype = c_otband
  4323.    m.bandcount = m.bandcount + 1
  4324.  
  4325.    DO CASE
  4326.    CASE objcode = 1
  4327.       m.pageheader = m.bandcount
  4328.    CASE objcode = 2
  4329.       m.colheader  = m.bandcount
  4330.    CASE objcode = 6
  4331.       m.colfooter  = m.bandcount
  4332.    CASE objcode = 7
  4333.       m.pagefooter = m.bandcount
  4334.    ENDCASE
  4335.  
  4336.    * The To fields are already converted at this point
  4337.    bands[m.bandCount,c_tobandvpos] = m.toposition
  4338.    DO CASE
  4339.    CASE m.g_char2grph
  4340.       bands[m.bandCount,c_tobandheight] ;
  4341.          = HEIGHT + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4342.    CASE m.g_grph2char
  4343.       bands[m.bandCount,c_tobandheight] = height
  4344.    CASE m.g_grph2grph
  4345.       bands[m.bandCount,c_tobandheight] = height + ;
  4346.          m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4347.    ENDCASE
  4348.  
  4349.    m.objcode = objcode
  4350.    m.expr    = expr
  4351.    m.saverec = RECNO()
  4352.  
  4353.    IF !EMPTY(expr)
  4354.       LOCATE FOR platform = m.g_fromplatform AND ;
  4355.          objtype = c_otband AND objcode = m.objcode AND expr = m.expr
  4356.    ELSE
  4357.       * The expression is empty, which means this is probably a group footer.  There could
  4358.       * be many of them, all empty.  We have to find the right one.
  4359.       GOTO TOP
  4360.       * Figure out which occurrence this one is.
  4361.       COUNT TO m.seq FOR platform = m.g_toplatform AND ;
  4362.          objtype = c_otband AND objcode = m.objcode AND EMPTY(expr) ;
  4363.          AND RECNO() <= m.saverec
  4364.       GOTO TOP
  4365.       * Now find the corresponding band in the "from" platform
  4366.       LOCATE FOR platform = m.g_fromplatform AND ;
  4367.          objtype = c_otband AND objcode = m.objcode AND EMPTY(expr)
  4368.       m.i = 1
  4369.       DO WHILE FOUND() AND m.i < m.seq
  4370.          m.i = m.i + 1
  4371.          CONTINUE
  4372.       ENDDO
  4373.    ENDIF
  4374.    IF FOUND()
  4375.       bands[m.bandCount,c_fmbandvpos] = m.fromposition
  4376.       DO CASE
  4377.       CASE m.g_char2grph
  4378.          bands[m.bandCount,c_fmbandheight] = height
  4379.       CASE m.g_grph2char
  4380.          bands[m.bandCount,c_fmbandheight] = height ;
  4381.              + IIF(m.g_fromplatform = c_macname,m.g_macbandheight, m.g_winbandheight)
  4382.       CASE m.g_grph2grph
  4383.          bands[m.bandCount,c_fmbandheight] = height + m.g_bandheight
  4384.       ENDCASE
  4385.  
  4386.       m.fromposition = m.fromposition + bands[m.bandCount,c_fmbandheight]
  4387.  
  4388.       IF m.g_grph2char
  4389.          * Resize 'to' band if necessary to account for boxes that narrowly
  4390.          * surround text on a graphic platform.  Sometimes the box can be
  4391.          * tightly against the text such that the graphical band appears to
  4392.          * be only two rows high.  We need three rows to display the box in
  4393.          * a character platform
  4394.          bands[m.bandCount,c_tobandheight] = ;
  4395.             resizeband(bands[m.bandCount,c_tobandheight], ;
  4396.             bands[m.bandCount,c_fmbandvpos  ], ;
  4397.             bands[m.bandCount,c_fmbandheight])
  4398.       ENDIF
  4399.    ELSE
  4400.       bands[m.bandCount,c_fmbandvpos] = 9999999
  4401.       bands[m.bandCount,c_fmbandheight] = 9999999
  4402.    ENDIF
  4403.  
  4404.  
  4405.    m.toposition = m.toposition + bands[m.bandCount,c_tobandheight]
  4406.  
  4407.    GOTO RECORD (m.saverec)
  4408.  
  4409.    IF m.g_grph2char
  4410.       * Stuff the newly recomputed height into the DOS record
  4411.       REPLACE height WITH bands[m.bandCount,c_tobandheight]
  4412.    ENDIF
  4413.  
  4414. ENDSCAN
  4415.  
  4416.  
  4417. IF !m.g_grph2grph
  4418.    * We don't want to have any column headers/footers in the character
  4419.    * products so we need to combine them with the page headers/footers.
  4420.    IF m.colfooter > 0 AND m.pagefooter > 0
  4421.       bands[m.pageFooter,c_tobandvpos] = bands[m.colFooter,c_tobandvpos]
  4422.       bands[m.pageFooter,c_tobandheight];
  4423.          = bands[m.pageFooter,c_tobandheight] ;
  4424.          + bands[m.colFooter,c_tobandheight]
  4425.       bands[m.pageFooter,c_fmbandvpos] = bands[m.colFooter,c_fmbandvpos]
  4426.       bands[m.pageFooter,c_fmbandheight] ;
  4427.          = bands[m.pageFooter,c_fmbandheight] ;
  4428.          + bands[m.colFooter,c_fmbandheight]
  4429.  
  4430.       LOCATE FOR platform = m.g_toplatform ;
  4431.          AND objtype = c_otband AND objcode = 6
  4432.       IF FOUND()
  4433.          DELETE
  4434.       ENDIF
  4435.  
  4436.       LOCATE FOR platform = m.g_toplatform ;
  4437.          AND objtype = c_otband AND objcode = 7
  4438.       IF FOUND()
  4439.          REPLACE height WITH height + bands[m.colFooter,c_tobandheight]
  4440.       ENDIF
  4441.  
  4442.       =ADEL(bands,m.colfooter)
  4443.       m.bandcount = m.bandcount - 1
  4444.    ENDIF
  4445.  
  4446.    IF m.colheader > 0 AND m.pageheader > 0
  4447.       bands[m.pageHeader,c_tobandheight];
  4448.          = bands[m.pageHeader,c_tobandheight] ;
  4449.          + bands[m.colHeader,c_tobandheight]
  4450.       bands[m.pageHeader,c_fmbandheight] ;
  4451.          = bands[m.pageHeader,c_fmbandheight] ;
  4452.          + bands[m.colHeader,c_fmbandheight]
  4453.  
  4454.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 2
  4455.       IF FOUND()
  4456.          DELETE
  4457.       ENDIF
  4458.  
  4459.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 1
  4460.       IF FOUND()
  4461.          REPLACE height WITH height + bands[m.colHeader,c_tobandheight]
  4462.       ENDIF
  4463.  
  4464.       =ADEL(bands,m.colheader)
  4465.       m.bandcount = m.bandcount - 1
  4466.    ENDIF
  4467. ENDIF
  4468. RETURN m.bandcount
  4469.  
  4470.  
  4471. *!*****************************************************************************
  4472. *!
  4473. *!      Procedure: CLONEBAND
  4474. *!
  4475. *!      Called by: RPTCONVERT         (procedure in TRANSPRT.PRG)
  4476. *!
  4477. *!*****************************************************************************
  4478. PROCEDURE cloneband
  4479. * Copy the band header record data into the respective footer bands.  Data in band header
  4480. * and footer records must match on Windows.  The main data that needs to match is the
  4481. * group expression and things like how many spaces to require after a heading
  4482. * before doing a page break.
  4483. PRIVATE m.in_area, m.in_rec, m.pivot, m.ouniqid, m.ovpos, m.ohpos, m.owidth, m.oheight,;
  4484.    m.oobjcode, m.headband
  4485. IF m.g_char2grph
  4486.    m.in_area = SELECT()
  4487.    m.in_rec = RECNO()
  4488.    * First find the detail band.  It acts as a pivot.
  4489.    GOTO TOP
  4490.    LOCATE FOR platform = m.g_toplatform ;
  4491.       AND objtype = c_otband ;
  4492.       AND objcode = 4     && detail band has code = 4
  4493.    IF !FOUND()
  4494.       * Return and make the best of it
  4495.       RETURN
  4496.    ENDIF
  4497.    m.pivot = RECNO()
  4498.  
  4499.    * Scan for each of the header bands
  4500.    SCAN FOR platform = m.g_toplatform ;
  4501.          AND objtype = c_otband ;
  4502.          AND objcode < 4 AND objcode > 0
  4503.       SCATTER MEMVAR MEMO
  4504.  
  4505.       m.headband = RECNO()
  4506.  
  4507.       * Go to the matching footer band record
  4508.       GOTO (m.pivot + (m.pivot - RECNO()))
  4509.  
  4510.       * Store the values we don't want to copy from the header
  4511.       m.ouniqid  = uniqueid
  4512.       m.ovpos    = vpos
  4513.       m.ohpos    = hpos
  4514.       m.oheight  = height
  4515.       m.oobjcode = objcode
  4516.  
  4517.       * Stuff header data into this footer band
  4518.       GATHER MEMVAR MEMO
  4519.  
  4520.       * Restore the data we didn't want to copy from the header
  4521.       REPLACE vpos WITH m.ovpos, hpos WITH m.ohpos, ;
  4522.          height WITH m.oheight, objcode WITH m.oobjcode, ;
  4523.          uniqueid WITH m.ouniqid
  4524.  
  4525.       GOTO (m.headband)
  4526.  
  4527.    ENDSCAN
  4528.    SELECT (m.in_area)
  4529.    GOTO (MIN(m.in_rec,RECCOUNT()))
  4530. ENDIF
  4531.  
  4532. RETURN
  4533.  
  4534. *
  4535. * RESIZEBAND - Resize the character mode report band to accommodate
  4536. * boxes, etc.
  4537. *
  4538. *!*****************************************************************************
  4539. *!
  4540. *!      Procedure: RESIZEBAND
  4541. *!
  4542. *!      Called by: BANDINFO()         (function  in TRANSPRT.PRG)
  4543. *!
  4544. *!          Calls: CVTREPORTVERTICAL()(function  in TRANSPRT.PRG)
  4545. *!
  4546. *!*****************************************************************************
  4547. PROCEDURE resizeband
  4548. PARAMETER tobandheight, fmbandvpos, fmbandheight
  4549.  
  4550. PRIVATE in_rec, minbandheight
  4551. m.in_rec = RECNO()
  4552. m.minbandheight = m.tobandheight
  4553. IF m.g_grph2char
  4554.    * Search for boxes that lie entirely within this band.
  4555.    SCAN FOR platform = m.g_fromplatform ;
  4556.          AND objtype = c_otbox AND vpos >= m.fmbandvpos ;
  4557.          AND vpos + height <= m.fmbandvpos + m.fmbandheight
  4558.       * The box needs to be expanded
  4559.       m.minbandheight = MAX(m.minbandheight,cvtreportvertical(height)+1)
  4560.       * If there is a box in the band, always make it at least three rows
  4561.       m.minbandheight = MAX(m.minbandheight,3)
  4562.    ENDSCAN
  4563. ENDIF
  4564. GOTO RECORD (m.in_rec)
  4565. RETURN CEILING(m.minbandheight)
  4566.  
  4567. *
  4568. * BandHeight - Given a band ID and platform, this function reurns the band's
  4569. *      starting position in that platform.
  4570. *
  4571. *!*****************************************************************************
  4572. *!
  4573. *!       Function: BANDPOS
  4574. *!
  4575. *!      Called by: NEWBANDS           (procedure in TRANSPRT.PRG)
  4576. *!               : EMPTYBAND()        (function  in TRANSPRT.PRG)
  4577. *!
  4578. *!*****************************************************************************
  4579. FUNCTION bandpos
  4580. PARAMETER m.objid, m.platform
  4581. PRIVATE m.saverec, m.bandstart
  4582. m.saverec = RECNO()
  4583. m.bandstart = 0
  4584.  
  4585. SCAN FOR platform = m.platform AND objtype = c_otband
  4586.    IF uniqueid <> m.objid
  4587.       IF m.platform = c_dosname OR m.platform = c_unixname
  4588.          m.bandstart = m.bandstart + height
  4589.       ELSE
  4590.          m.bandstart = m.bandstart + height + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4591.       ENDIF
  4592.    ELSE
  4593.       LOCATE FOR .F.
  4594.    ENDIF
  4595. ENDSCAN
  4596.  
  4597. GOTO RECORD (m.saverec)
  4598. RETURN m.bandstart
  4599.  
  4600. *
  4601. * EmptyBand - Given a band ID, this funtion determines if the band is empty.
  4602. *
  4603. *!*****************************************************************************
  4604. *!
  4605. *!       Function: EMPTYBAND
  4606. *!
  4607. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4608. *!
  4609. *!          Calls: BANDPOS()          (function  in TRANSPRT.PRG)
  4610. *!
  4611. *!*****************************************************************************
  4612. FUNCTION emptyband
  4613. PARAMETER m.id
  4614. PRIVATE m.saverec, m.bandstart, m.bandheight, m.retval
  4615. IF m.g_toplatform = c_dosname OR m.g_toplatform = c_unixname
  4616.    RETURN .F.
  4617. ENDIF
  4618.  
  4619. m.saverec = RECNO()
  4620. m.retval = .F.
  4621.  
  4622. LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.id
  4623. IF FOUND()
  4624.    m.bandheight = height
  4625.    m.bandstart = bandpos(m.id, m.g_fromplatform)
  4626.    * Look for objects in this band
  4627.    LOCATE FOR platform = m.g_fromplatform AND ;
  4628.       (objtype = c_otline OR objtype = c_otbox OR ;
  4629.       objtype = c_ottext OR objtype = c_otrepfld) AND ;
  4630.       vpos >= m.bandstart AND vpos < m.bandstart + m.bandheight
  4631.    IF !FOUND() AND m.g_char2grph
  4632.       * Look for a DOS box or line that ends in the band
  4633.       GOTO TOP
  4634.       LOCATE FOR platform = m.g_fromplatform AND ;
  4635.          INLIST(objtype,c_otbox, c_otline) AND ;
  4636.          vpos + height - 1 >= m.bandstart AND vpos + height - 1 < m.bandstart + m.bandheight
  4637.    ENDIF
  4638.    m.retval = !FOUND()
  4639. ENDIF
  4640.  
  4641. GOTO RECORD (m.saverec)
  4642. RETURN m.retval
  4643.  
  4644. *
  4645. * GETBANDCODE - returns band objcode given a vpos
  4646. *
  4647. *!*****************************************************************************
  4648. *!
  4649. *!       Function: GETBANDCODE
  4650. *!
  4651. *!      Called by: SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  4652. *!
  4653. *!*****************************************************************************
  4654. FUNCTION getbandcode
  4655. PARAMETER m.thisvpos
  4656. PRIVATE m.in_num, m.retcode
  4657. retcode = -1
  4658. m.in_num = RECNO()
  4659. m.startvpos = 0
  4660.  
  4661. IF INLIST(objtype,c_otheader, c_otband, c_otrel, c_otworkar, c_otindex)
  4662.    RETURN -1
  4663. ENDIF
  4664.  
  4665. SET FILTER TO platform = m.g_toplatform AND (objtype = c_otband)
  4666. GOTO TOP
  4667. DO WHILE m.startvpos <= m.thisvpos AND !EOF()
  4668.    IF m.startvpos + height +m.g_bandheight > m.thisvpos
  4669.       retcode = objcode
  4670.       EXIT
  4671.    ELSE
  4672.       m.startvpos = m.startvpos + height + m.g_bandheight
  4673.       SKIP
  4674.    ENDIF
  4675. ENDDO
  4676. SET FILTER TO
  4677. GOTO m.in_num
  4678. RETURN retcode
  4679.  
  4680.  
  4681. *!*****************************************************************************
  4682. *!
  4683. *!       Function: GRPHRPTCVT
  4684. *!
  4685. *!*****************************************************************************
  4686. PROCEDURE grphrptcvt
  4687. PRIVATE m.bandnum
  4688. * Convert single report object from one graphical platform to another
  4689. * The vpos adjustment reflects the fact that Windows report bands are
  4690. * 20 pixels high while Mac ones are 15 pixels high.
  4691. IF m.g_filetype = c_report    && labels don't require this conversion
  4692.     DO CASE
  4693.         CASE _WINDOWS
  4694.                IF objtype = c_ottext
  4695.                   * Compute text object width exactly
  4696.                   REPLACE width  WITH gettextwidth(expr)
  4697.                ENDIF
  4698.         CASE _MAC
  4699.             DO CASE
  4700.                    CASE objtype = c_ottext
  4701.                       * Compute text object width exactly
  4702.                       REPLACE width  WITH gettextwidth(expr)
  4703.                    CASE objtype = c_otpicture
  4704.                       REPLACE width WITH width * 96 / 72
  4705.                ENDCASE
  4706.             IF !m.g_newobjmode OR objtype = c_otband
  4707.                 m.bandnum = getbandnum(vpos,"WINDOWS")
  4708.                 IF objtype <> c_otline OR height > width
  4709.                     *- REPLACE height WITH height * 96 / 72        &&commented this out -- gives bad results (jd 3/24/96)
  4710.                 ENDIF
  4711.                 REPLACE vpos    WITH (vpos - ((m.bandnum-1) * (5/96) * 10000)) &&  * 96 / 72
  4712.             ENDIF
  4713.    ENDCASE
  4714. ENDIF
  4715.  
  4716. *!*****************************************************************************
  4717. *!
  4718. *!       Function: GETBANDNUM
  4719. *!
  4720. *!*****************************************************************************
  4721. FUNCTION getbandnum
  4722. PARAMETER m.theVpos, m.thePlat
  4723. PRIVATE m.bandno, m.past, m.cumvpos, m.therec
  4724. * Returns the band number that an object falls into.
  4725. m.bandno = 0
  4726. m.past = .F.
  4727. m.cumvpos = 0
  4728. m.therec = RECNO()
  4729. SCAN FOR platform = m.thePlat AND objtype = c_otband AND !m.past
  4730.    m.cumvpos = m.cumvpos + height
  4731.    IF m.bandno > 0
  4732.       m.cumvpos = m.cumvpos + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4733.    ENDIF
  4734.    IF m.cumvpos >= m.theVpos
  4735.       m.past = .T.
  4736.    ENDIF
  4737.    m.bandno = m.bandno + 1
  4738. ENDSCAN
  4739. GOTO m.therec
  4740. IF m.past
  4741.    RETURN m.bandno
  4742. ELSE
  4743.    RETURN -1    && couldn't find the band
  4744. ENDIF
  4745.  
  4746. *!*****************************************************************************
  4747. *!
  4748. *!       Function: GETTEXTWIDTH
  4749. *!
  4750. *!*****************************************************************************
  4751. FUNCTION gettextwidth
  4752. PARAMETER m.strg
  4753. * Figure out how many 10000-ths of an inch a text object requires
  4754.  
  4755. * Don't count the quotation marks
  4756. m.strg = ALLTRIM(CHRTRANC(expr,CHR(0),""))
  4757. IF LEFT(m.strg,1) = '"'
  4758.    m.strg = SUBSTR(m.strg,2)
  4759. ENDIF
  4760. IF RIGHT(m.strg,1) = '"'
  4761.    m.strg = SUBSTR(m.strg,1,LEN(m.strg)-1)
  4762. ENDIF
  4763.  
  4764. RETURN TXTWIDTH(m.strg,fontface,fontsize,num2style(fontstyle)) * ;
  4765.       FONTMETRIC(6,fontface,fontsize,num2style(fontstyle)) * 10000 / m.g_pixelsize
  4766.  
  4767. *
  4768. * CvtReportVertical - Convert report vertical dimensions between 10000ths of an inch and characters
  4769. *      depending on the to platform.  (This function is for vertical dimensions only).
  4770. *
  4771. *!*****************************************************************************
  4772. *!
  4773. *!       Function: CVTREPORTVERTICAL
  4774. *!
  4775. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4776. *!               : RESIZEBAND         (procedure in TRANSPRT.PRG)
  4777. *!
  4778. *!*****************************************************************************
  4779. FUNCTION cvtreportvertical
  4780. PARAMETER m.units
  4781. DO CASE
  4782. CASE m.g_grph2char
  4783.    RETURN m.units/10000 * c_linesperinch
  4784. CASE m.g_char2grph
  4785.    RETURN (m.units * m.g_rptlinesize) + (5000/m.g_pixelsize)
  4786. OTHERWISE
  4787.    RETURN m.units
  4788. ENDCASE
  4789.  
  4790. *
  4791. * CvtReportWidth - Convert report horizontal dimensions between 10000ths of an inch
  4792. *      and chanracters depending on the to platform.
  4793. *
  4794. *!*****************************************************************************
  4795. *!
  4796. *!       Function: CVTREPORTHORIZONTAL
  4797. *!
  4798. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4799. *!
  4800. *!*****************************************************************************
  4801. FUNCTION cvtreporthorizontal
  4802. PARAMETER m.units
  4803. DO CASE
  4804. CASE m.g_grph2char
  4805.    RETURN m.units/10000 * c_charsperinch
  4806. CASE m.g_char2grph
  4807.    RETURN m.units * m.g_rptcharsize
  4808. OTHERWISE
  4809.    RETURN m.units
  4810. ENDCASE
  4811. *!*****************************************************************************
  4812. *!
  4813. *!       Function: CVTRPTLINES
  4814. *!
  4815. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4816. *!
  4817. *!*****************************************************************************
  4818. FUNCTION cvtrptlines
  4819. * Adjust the height of horizontal lines
  4820. PARAMETER m.height
  4821. IF _MAC
  4822.    * Adjust for 72 to 96 conversion
  4823.    m.height = m.height * 72 / 96
  4824. ENDIF
  4825. DO CASE
  4826. CASE g_char2grph
  4827.    DO CASE
  4828.    CASE BETWEEN(m.height,0,200)
  4829.       RETURN 104
  4830.    CASE BETWEEN(m.height,200,600)
  4831.       RETURN 520
  4832.    CASE BETWEEN(m.height,600,850)
  4833.       RETURN 850
  4834.    OTHERWISE
  4835.       RETURN m.height
  4836.    ENDCASE
  4837. OTHERWISE
  4838.    RETURN m.height
  4839. ENDCASE
  4840.  
  4841. *
  4842. * MergeLabelObjects - Combines report objects which lie on the same line
  4843. *      when going from a graphical platform to a character platform.
  4844. *
  4845. *!*****************************************************************************
  4846. *!
  4847. *!      Procedure: MERGELABELOBJECTS
  4848. *!
  4849. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4850. *!
  4851. *!          Calls: LABELOBJMERGE      (procedure in TRANSPRT.PRG)
  4852. *!
  4853. *!        Indexes: TEMP                   (tag)
  4854. *!
  4855. *!*****************************************************************************
  4856. PROCEDURE mergelabelobjects
  4857.  
  4858. IF !m.g_grph2grph
  4859.     INDEX ON platform+STR(vpos,3)+STR(hpos,3) TAG temp
  4860.  
  4861.     SCAN FOR platform = m.g_toplatform AND !DELETED() AND ;
  4862.           (objtype = c_otrepfld OR objtype = c_ottext OR objtype = c_otbox OR objtype = c_otline)
  4863.        DO labelobjmerge WITH RECNO()
  4864.     ENDSCAN
  4865.  
  4866.     DELETE TAG temp
  4867. ENDIF
  4868. RETURN
  4869.  
  4870. *
  4871. * LabelObjMerge - Given a record which is a report object, this function tries to find a label
  4872. *      object on the same line and combine them.  If no label object exists on the line, the
  4873. *      record is turned into one.
  4874. *
  4875. *!*****************************************************************************
  4876. *!
  4877. *!      Procedure: LABELOBJMERGE
  4878. *!
  4879. *!      Called by: MERGELABELOBJECTS  (procedure in TRANSPRT.PRG)
  4880. *!
  4881. *!*****************************************************************************
  4882. PROCEDURE labelobjmerge
  4883. PARAMETER m.recno
  4884. PRIVATE m.saverec, m.vpos, m.hpos, m.width, m.height, m.expr, m.type, m.picture
  4885.  
  4886. m.saverec = RECNO()
  4887. GOTO RECORD (m.recno)
  4888.  
  4889. m.vpos = vpos
  4890. m.width = WIDTH
  4891. m.expr = expr
  4892. m.type = fillchar
  4893. m.picture = PICTURE
  4894. DELETE
  4895.  
  4896. LOCATE FOR platform = m.g_toplatform AND !DELETED() AND ;
  4897.    objtype = c_ot20lbxobj AND vpos = m.vpos
  4898. IF FOUND()
  4899.    REPLACE expr WITH expr + "," + m.expr
  4900. ELSE
  4901.    GOTO RECORD (m.recno)
  4902.    RECALL
  4903.    REPLACE objtype WITH c_ot20lbxobj
  4904. ENDIF
  4905.  
  4906. GOTO RECORD (m.saverec)
  4907.  
  4908. *
  4909. * AddLabelBlanks - Adds sufficient blank lines to make the converted lines
  4910. *
  4911. *!*****************************************************************************
  4912. *!
  4913. *!      Procedure: ADDLABELBLANKS
  4914. *!
  4915. *!           Uses: M.G_SCRNALIAS
  4916. *!
  4917. *!*****************************************************************************
  4918. PROCEDURE addlabelblanks
  4919. PRIVATE m.linecount, m.last, m.scanloop
  4920. SELECT vpos FROM m.g_scrnalias ;
  4921.    WHERE !DELETED() AND platform = m.g_toplatform AND objtype = c_ot20lbxobj ;
  4922.    ORDER BY vpos ;
  4923.    INTO ARRAY lines
  4924.  
  4925. m.linecount = _TALLY
  4926. m.last = 0
  4927. FOR m.scanloop = 1 TO lines[m.linecount]
  4928.    IF ASCAN(lines, m.scanloop) = 0
  4929.       APPEND BLANK
  4930.       REPLACE platform WITH m.g_toplatform
  4931.       REPLACE objtype WITH c_ot20lbxobj
  4932.       REPLACE vpos WITH m.lines
  4933.    ENDIF
  4934. ENDFOR
  4935. RETURN
  4936.  
  4937. *
  4938. * LinesBetween - Removes all the whitespace from the bottom of the detail
  4939. *      band and puts it in lines between.
  4940. *
  4941. *!*****************************************************************************
  4942. *!
  4943. *!      Procedure: LINESBETWEEN
  4944. *!
  4945. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4946. *!
  4947. *!*****************************************************************************
  4948. PROCEDURE linesbetween
  4949. PRIVATE m.linecount, m.blanklines
  4950.  
  4951. IF !m.g_grph2grph
  4952.     COUNT TO m.linecount FOR platform = m.g_toplatform AND objtype = c_ot20lbxobj
  4953.  
  4954.     LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 4
  4955.     IF FOUND() AND m.linecount < height
  4956.        m.blanklines = height - m.linecount
  4957.        REPLACE height WITH m.linecount
  4958.        LOCATE FOR platform = m.g_toplatform AND objtype = c_ot20label
  4959.        IF FOUND()
  4960.           REPLACE penblue WITH m.blanklines
  4961.        ENDIF
  4962.     ENDIF
  4963. ENDIF
  4964.  
  4965. *
  4966. * labelBands - Adds the group records needed by a graphical label
  4967. *
  4968. *!*****************************************************************************
  4969. *!
  4970. *!      Procedure: LABELBANDS
  4971. *!
  4972. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4973. *!
  4974. *!*****************************************************************************
  4975. PROCEDURE labelbands
  4976. PRIVATE m.lbxheight, m.lbxwidth, m.lbxlinesbet
  4977.  
  4978. LOCATE FOR platform = m.g_fromplatform AND objtype = c_otband AND objcode = 4
  4979. IF FOUND()
  4980.    m.lbxheight = height
  4981. ENDIF
  4982.  
  4983. LOCATE FOR platform = m.g_fromplatform AND objtype = c_ot20label
  4984. IF FOUND()
  4985.    DO CASE
  4986.    CASE name = '3 1/2" x 15/16" x 1' AND penblue = 1 AND ;
  4987.          WIDTH = 35 AND m.lbxheight = 5 AND vpos = 1 AND hpos = 0 AND height = 0
  4988.       m.lbxheight = (15/16) * 10000
  4989.       m.lbxwidth = -1
  4990.       m.lbxlinesbet = m.lbxheight / 5
  4991.  
  4992.    CASE name = '3 1/2" x 15/16" x 2' AND penblue = 1 AND ;
  4993.          WIDTH = 35 AND m.lbxheight = 5 AND vpos = 2 AND hpos = 0 AND height = 2
  4994.       m.lbxheight = (15/16) * 10000
  4995.       m.lbxwidth = (3 + (1/2)) * 10000
  4996.       m.lbxlinesbet = m.lbxheight / 5
  4997.  
  4998.    CASE name = '3 1/2" x 15/16" x 3' AND penblue = 1 AND ;
  4999.          WIDTH = 35 AND m.lbxheight = 5 AND vpos = 3 AND hpos = 0 AND height = 2
  5000.       m.lbxheight = (15/16) * 10000
  5001.       m.lbxwidth = (3 + (1/2)) * 10000
  5002.       m.lbxlinesbet = m.lbxheight / 5
  5003.  
  5004.    CASE name = '3 2/10" x 11/12" x 3 (Cheshire)' AND penblue = 1 AND ;
  5005.          WIDTH = 32 AND m.lbxheight = 5 AND vpos = 3 AND hpos = 0 AND height = 2
  5006.       m.lbxheight = (11/12) * 10000
  5007.       m.lbxwidth = (3 + (2/10)) * 10000
  5008.       m.lbxlinesbet = m.lbxheight / 5
  5009.  
  5010.    CASE name = '3" x 5 Rolodex' AND penblue = 4 AND ;
  5011.          WIDTH = 50 AND m.lbxheight = 14 AND vpos = 1 AND hpos = 0 AND height = 0
  5012.       m.lbxheight = 5 * 10000
  5013.       m.lbxwidth = -1
  5014.       m.lbxlinesbet = 4 * (m.lbxheight / 14)
  5015.  
  5016.    CASE name = '4" x 1 7/16" x 1' AND penblue = 1 AND ;
  5017.          WIDTH = 40 AND m.lbxheight = 8 AND vpos = 1 AND hpos = 0 AND height = 0
  5018.       m.lbxheight = (1 + (7/16)) * 10000
  5019.       m.lbxwidth = -1
  5020.       m.lbxlinesbet = m.lbxheight / 8
  5021.  
  5022.    CASE name = '4" x 2 1/4 Rolodex' AND penblue = 1 AND ;
  5023.          WIDTH = 40 AND m.lbxheight = 10 AND vpos = 1 AND hpos = 0 AND height = 0
  5024.       m.lbxheight = (2 + (1/4)) * 10000
  5025.       m.lbxwidth = -1
  5026.       m.lbxlinesbet = m.lbxheight / 10
  5027.  
  5028.    CASE name = '6 1/2" x 3 5/8 Envelope' AND penblue = 8 AND ;
  5029.          WIDTH = 65 AND m.lbxheight = 14 AND vpos = 1 AND hpos = 0 AND height = 0
  5030.       m.lbxheight = (3 + (5/8)) * 10000
  5031.       m.lbxwidth = -1
  5032.       m.lbxlinesbet = 8 * (m.lbxheight / 14)
  5033.  
  5034.    CASE name = '9 7/8" x 7 1/8 Envelope' AND penblue = 8 AND ;
  5035.          WIDTH = 78 AND m.lbxheight = 17 AND vpos = 1 AND hpos = 0 AND height = 0
  5036.       m.lbxheight = (7 + (1/8)) * 10000
  5037.       m.lbxwidth = -1
  5038.       m.lbxlinesbet = 8 * (m.lbxheight / 17)
  5039.  
  5040.    OTHERWISE
  5041.       m.lbxheight = m.lbxheight * m.g_rptlinesize
  5042.       m.lbxwidth = IIF(vpos > 1, WIDTH * m.g_rptcharsize, -1)
  5043.       m.lbxlinesbet = penblue * m.g_rptlinesize
  5044.    ENDCASE
  5045. ELSE
  5046.    RETURN
  5047. ENDIF
  5048.  
  5049. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  5050. IF FOUND()
  5051.    REPLACE vpos WITH IIF(vpos > 1, vpos * m.g_rptlinesize, 1)
  5052.    REPLACE WIDTH WITH m.lbxwidth
  5053.    REPLACE hpos WITH hpos * m.g_rptcharsize      && Left margin
  5054.    REPLACE height WITH height * m.g_rptcharsize   && Spaces Between Columns
  5055. ENDIF
  5056.  
  5057. LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 4
  5058. IF FOUND()
  5059.    REPLACE height WITH m.lbxheight + m.lbxlinesbet
  5060. ENDIF
  5061.  
  5062. *
  5063. * labelLines - Converts the character style label objects to graphical report objects
  5064. *
  5065. *!*****************************************************************************
  5066. *!
  5067. *!      Procedure: LABELLINES
  5068. *!
  5069. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5070. *!
  5071. *!          Calls: ADJFONT            (procedure in TRANSPRT.PRG)
  5072. *!               : ADJCOLOR           (procedure in TRANSPRT.PRG)
  5073. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5074. *!
  5075. *!*****************************************************************************
  5076. PROCEDURE labellines
  5077. PRIVATE m.bandstart, m.linecount, m.thermstep, m.lbxwidth, ;
  5078.    m.saverec, m.nextexpr, m.loop
  5079.  
  5080. COUNT TO m.thermstep FOR platform = m.g_toplatform AND objtype = c_ot20lbxobj
  5081. m.thermstep = 45 / m.thermstep
  5082. m.bandstart = 4166.667
  5083.  
  5084. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  5085. IF WIDTH != -1
  5086.    m.lbxwidth = WIDTH
  5087. ELSE
  5088.    LOCATE FOR platform = m.g_fromplatform AND objtype = c_ot20label
  5089.    m.lbxwidth = WIDTH * m.g_rptcharsize
  5090. ENDIF
  5091.  
  5092. m.linecount = 0
  5093.  
  5094. SCAN FOR platform = m.g_toplatform AND objtype = c_ot20lbxobj AND !DELETED()
  5095.    REPLACE expr WITH ALLTRIM(expr)
  5096.    REPLACE objtype WITH c_otrepfld
  5097.    REPLACE objcode WITH 0
  5098.    REPLACE vpos WITH m.bandstart + (m.linecount * m.g_rptlinesize)
  5099.    REPLACE hpos WITH 0
  5100.    REPLACE height WITH m.g_rptlinesize
  5101.    REPLACE WIDTH WITH m.lbxwidth
  5102.    REPLACE fillchar WITH "C"
  5103.    REPLACE FLOAT WITH .F.
  5104.    REPLACE STRETCH WITH .F.
  5105.    REPLACE spacing WITH 12
  5106.    REPLACE offset WITH 0
  5107.    REPLACE totaltype WITH 0
  5108.    REPLACE TOP WITH .T.
  5109.    REPLACE resettotal WITH 1
  5110.    REPLACE supalways WITH .T.
  5111.    REPLACE supovflow WITH .F.
  5112.    REPLACE suprpcol WITH 3
  5113.    REPLACE supgroup WITH 0
  5114.    REPLACE supvalchng WITH .F.
  5115.  
  5116.    DO adjfont
  5117.    DO adjcolor
  5118.  
  5119.    m.loop = (RIGHT(expr,1) = ";")
  5120.    DO WHILE m.loop
  5121.       m.saverec = RECNO()
  5122.       SKIP
  5123.       DO WHILE platform = m.g_toplatform AND objtype = c_ot20lbxobj AND DELETED()
  5124.          SKIP
  5125.       ENDDO
  5126.       IF platform = m.g_toplatform AND objtype = c_ot20lbxobj
  5127.          DELETE
  5128.          m.nextexpr = expr
  5129.          GOTO RECORD (m.saverec)
  5130.          REPLACE expr WITH expr + m.nextexpr
  5131.          REPLACE height WITH height + m.g_rptlinesize
  5132.          m.loop = (RIGHT(expr,1) = ";")
  5133.       ELSE
  5134.          GOTO RECORD (m.saverec)
  5135.          m.loop = .F.
  5136.       ENDIF
  5137.    ENDDO
  5138.  
  5139.    m.linecount = m.linecount + 1
  5140.  
  5141.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5142.    DO updtherm WITH m.g_mercury
  5143. ENDSCAN
  5144.  
  5145. *
  5146. * calcpositions - Calculate each objects position as a percentage across
  5147. *            and down the window.
  5148. *
  5149. *!*****************************************************************************
  5150. *!
  5151. *!      Procedure: CALCPOSITIONS
  5152. *!
  5153. *!      Called by: ALLOTHERS          (procedure in TRANSPRT.PRG)
  5154. *!
  5155. *!*****************************************************************************
  5156. PROCEDURE calcpositions
  5157. PARAMETER m.index
  5158. PRIVATE m.record, m.vert, m.horiz, m.width, m.numothers, m.thermstep, m.i
  5159. *
  5160. * Search for the original platform records and establish the horizontal
  5161. * and vertical positioning percentages.
  5162. *
  5163.  
  5164. objectpos[m.index, 1] = hpos / m.g_windwidth
  5165. objectpos[m.index, 2] = vpos / m.g_windheight
  5166. objectpos[m.index, 3] = uniqueid
  5167. objectpos[m.index, 4] = objtype
  5168. objectpos[m.index, 5] = .F.                && right aligned with object above or below?
  5169. objectpos[m.index, 6] = hpos
  5170. objectpos[m.index, 7] = WIDTH
  5171. objectpos[m.index, 8] = spacing
  5172. objectpos[m.index, 9] = PICTURE
  5173.  
  5174. IF objtype = c_ottext
  5175.    m.record = RECNO()
  5176.    m.vert1 = vpos
  5177.    m.horiz = hpos
  5178.    m.endpos = hpos + WIDTH
  5179.  
  5180.    LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5181.       m.vert1 - 1 = vpos AND hpos + WIDTH = m.endpos
  5182.    IF FOUND()
  5183.       objectpos[m.index,5] = .T.
  5184.       DO WHILE FOUND()
  5185.          IF objectpos[m.index, 7] < WIDTH
  5186.             objectpos[m.index, 7] = WIDTH
  5187.          ENDIF
  5188.          m.vert = vpos
  5189.          LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5190.             m.vert - 1 = vpos AND hpos + WIDTH = m.endpos
  5191.       ENDDO
  5192.    ENDIF
  5193.    LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5194.       m.vert1 + 1 = vpos AND hpos + WIDTH = m.endpos
  5195.  
  5196.    IF FOUND()
  5197.       objectpos[m.index,5] = .T.
  5198.       DO WHILE FOUND()
  5199.          IF objectpos[m.index, 7] < WIDTH
  5200.             objectpos[m.index, 7] = WIDTH
  5201.          ENDIF
  5202.          m.vert = vpos
  5203.          LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5204.             m.vert + 1 = vpos AND hpos + WIDTH = m.endpos
  5205.       ENDDO
  5206.    ENDIF
  5207.  
  5208.    GOTO RECORD m.record
  5209.    IF objectpos[m.index, 5]
  5210.       objectpos[m.index, 6] = hpos + WIDTH - 1
  5211.       objectpos[m.index, 1] = (hpos + WIDTH) / m.g_windwidth
  5212.    ENDIF
  5213.  
  5214. ENDIF
  5215.  
  5216. *
  5217. * calcwindowdimensions - Calculate the needed Height and Width for the new window
  5218. *
  5219. *!*****************************************************************************
  5220. *!
  5221. *!      Procedure: CALCWINDOWDIMENSIONS
  5222. *!
  5223. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5224. *!
  5225. *!          Calls: FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  5226. *!               : HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5227. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5228. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  5229. *!
  5230. *!        Indexes: UNIQUEID               (tag)
  5231. *!
  5232. *!*****************************************************************************
  5233. PROCEDURE calcwindowdimensions
  5234. PRIVATE m.i, m.curline, m.largestobj, m.lineheight, m.adjwindowwidth, m.thermstep
  5235.  
  5236. *- set relation off before indexing and creating the new relation
  5237. SELECT (m.g_fromobjonlyalias)
  5238. SET RELATION OFF INTO (m.g_scrnalias)
  5239. SELECT (m.g_scrnalias)
  5240. INDEX ON uniqueid + platform TAG uniqueid OF (m.g_tempindex) ADDITIVE
  5241. SELECT (m.g_fromobjonlyalias)
  5242. SET RELATION TO uniqueid+m.g_toplatform INTO (m.g_scrnalias) ADDITIVE
  5243. SELECT (m.g_scrnalias)
  5244.  
  5245. m.adjwindwidth = 0
  5246. DO findwiderobjects WITH m.adjwindwidth
  5247.  
  5248. =ASORT(objectpos,2)
  5249. STORE 0 TO m.curline, m.largestobj, m.lineheight, m.adjheight
  5250. m.thermstep = 10 / m.objindex
  5251.  
  5252. FOR m.i = 1 TO m.objindex
  5253.  
  5254.    IF objectpos[m.i,2] != m.curline
  5255.       m.adjheight = m.adjheight + m.lineheight
  5256.       STORE 0 TO m.lineheight, m.largestobj
  5257.       m.curline = objectpos[m.i,2]
  5258.    ENDIF
  5259.  
  5260.    IF m.largestobj != 3
  5261.       DO CASE
  5262.       CASE objectpos[m.i, 4] = c_ottxtbut AND m.largestobj < 3
  5263.          IF !horizbutton(objectpos[m.i, 9])
  5264.             m.numitems = OCCURS(';',objectpos[m.i, 9]) + 1
  5265.             m.lineheight = c_adjtbtn * m.numitems
  5266.          ELSE
  5267.             m.lineheight = c_adjtbtn
  5268.          ENDIF
  5269.          m.largestobj = 3
  5270.  
  5271.       CASE (objectpos[m.i, 4] = c_otradbut AND m.largestobj < 2) ;
  5272.             OR (objectpos[m.i, 4] = c_otchkbox AND m.largestobj < 2)
  5273.          IF objectpos[m.i, 4] = c_otradbut AND !horizbutton(objectpos[m.i, 9])
  5274.             m.numitems = OCCURS(';',objectpos[m.i, 9]) + 1
  5275.             m.lineheight = c_adjrbtn * m.numitems
  5276.          ELSE
  5277.             m.lineheight = c_adjrbtn
  5278.          ENDIF
  5279.          m.largestobj = 2
  5280.  
  5281.       CASE (objectpos[m.i, 4] = c_otlist AND m.largestobj < 1) ;
  5282.             OR (objectpos[m.i, 4] = c_otfield AND m.largestobj < 1)
  5283.          m.lineheight = c_adjlist
  5284.          m.largestobj = 1
  5285.  
  5286.       ENDCASE
  5287.    ENDIF
  5288.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5289.    DO updtherm WITH m.g_mercury
  5290.  
  5291. ENDFOR
  5292. m.adjheight = m.adjheight + m.lineheight
  5293. LOCATE FOR platform = m.g_toplatform AND objtype = 1
  5294. IF FOUND()
  5295.    REPLACE WIDTH WITH WIDTH + m.adjwindwidth
  5296.    DO repoobjects WITH HEIGHT + m.adjheight
  5297. ENDIF
  5298.  
  5299. RETURN
  5300.  
  5301. *
  5302. * findWiderObjects - Find objects which have changed in size
  5303. *
  5304. *!*****************************************************************************
  5305. *!
  5306. *!      Procedure: FINDWIDEROBJECTS
  5307. *!
  5308. *!      Called by: CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  5309. *!
  5310. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5311. *!               : SGN()              (function  in TRANSPRT.PRG)
  5312. *!               : ADJHPOS            (procedure in TRANSPRT.PRG)
  5313. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5314. *!
  5315. *!*****************************************************************************
  5316. PROCEDURE findwiderobjects
  5317. PARAMETER m.adjwindowwidth
  5318. PRIVATE m.curcol, m.adjcol, m.i, m.rightalignflag, m.numitems, ;
  5319.    m.olduniqueid, m.oldwidth, m.buttonflag, m.newwidth, m.adjust, m.thermstep
  5320.  
  5321. m.thermstep = 10 / m.objindex
  5322.  
  5323. =ASORT(objectpos,6)   && sort on hpos
  5324. STORE 0 TO m.curcol, m.adjcol
  5325. m.rightalignflag = .F.
  5326.  
  5327. FOR m.i = 1 TO m.objindex
  5328.    * Start at the leftmost object
  5329.    IF objectpos[m.i,6] != m.curcol
  5330.       m.adjcol = 0
  5331.       m.rightalignflag = .F.
  5332.       m.curcol = objectpos[m.i,6]
  5333.    ENDIF
  5334.  
  5335.    DO CASE
  5336.    CASE objectpos[m.i, 4] = c_ottxtbut OR objectpos[m.i, 4] = c_otradbut
  5337.       * Count the objects in push buttons and radio buttons
  5338.       m.numitems = OCCURS(';',objectpos[m.i, 9]) + 1
  5339.       m.olduniqueid = objectpos[m.i, 3]
  5340.  
  5341.       IF horizbutton(objectpos[m.i, 9])
  5342.          m.oldwidth = (objectpos[m.i, 7] * m.numitems) + ;
  5343.             (objectpos[m.i, 8] * (m.numitems - 1))
  5344.          m.buttonflag = .T.
  5345.       ELSE
  5346.          m.buttonflag = .F.
  5347.          m.oldwidth = objectpos[m.i, 7]
  5348.       ENDIF
  5349.  
  5350.    OTHERWISE
  5351.       m.buttonflag = .F.
  5352.       m.oldwidth = objectpos[m.i, 7]
  5353.       m.olduniqueid = objectpos[m.i, 3]
  5354.  
  5355.    ENDCASE
  5356.  
  5357.    LOCATE FOR uniqueid = m.olduniqueid AND platform = m.g_toplatform
  5358.    IF FOUND()
  5359.       IF m.buttonflag
  5360.          m.newwidth = (WIDTH * m.numitems) + ;
  5361.             (spacing * (m.numitems - 1))
  5362.       ELSE
  5363.          m.newwidth = WIDTH
  5364.       ENDIF
  5365.       IF m.oldwidth != m.newwidth AND ;
  5366.             !(objtype = c_ottext ;
  5367.             AND ASC(SUBSTR(expr,2,1))>=179 ;
  5368.             AND ASC(SUBSTR(expr,2,1))<=218)
  5369.          m.adjust = m.newwidth - m.oldwidth
  5370.          IF ABS(m.adjust) > ABS(m.adjcol) OR sgn(m.adjust) <> sgn(m.adjcol)
  5371.             IF (!objectpos[m.i,5] OR !m.rightalignflag) AND m.adjust > 0
  5372.                * Move everything over
  5373.                DO adjhpos WITH m.adjust - m.adjcol, ;
  5374.                   IIF(objectpos[m.i,5], objectpos[m.i, 6], ;
  5375.                   objectpos[m.i, 6] + objectpos[m.i, 7] - 1)
  5376.  
  5377.                * Expand the window
  5378.                m.adjwindowwidth = m.adjwindowwidth + m.adjust - m.adjcol
  5379.  
  5380.                * AdjCol contains the cumulative adjustment
  5381.                m.adjcol = m.adjust
  5382.  
  5383.                IF objectpos[m.i, 5]
  5384.                   m.rightalignflag = .T.
  5385.                   REPLACE hpos WITH hpos + m.adjust - m.adjcol
  5386.                ENDIF
  5387.             ENDIF
  5388.          ENDIF
  5389.       ENDIF
  5390.    ENDIF
  5391.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5392.    DO updtherm WITH m.g_mercury
  5393. ENDFOR
  5394. RETURN
  5395.  
  5396. *
  5397. * adjHpos - Adjust the horizontal position of objects across as other objects
  5398. *       become bigger or smaller.
  5399. *
  5400. *!*****************************************************************************
  5401. *!
  5402. *!      Procedure: ADJHPOS
  5403. *!
  5404. *!      Called by: FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  5405. *!
  5406. *!*****************************************************************************
  5407. PROCEDURE adjhpos
  5408. PARAMETER m.adjustment, m.position
  5409.  
  5410. SELECT (m.g_fromobjonlyalias)
  5411. SCAN FOR platform = m.g_fromplatform AND hpos >= m.position
  5412.    REPLACE &g_scrnalias..hpos WITH &g_scrnalias..hpos + m.adjustment
  5413. ENDSCAN
  5414.  
  5415. * Stretch lines that begin before the wider object and end after it starts.
  5416. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND height = 1 AND ;
  5417.       hpos < m.position AND hpos + WIDTH - 1 >= m.position
  5418.    REPLACE &g_scrnalias..width WITH &g_scrnalias..width + m.adjustment
  5419. ENDSCAN
  5420. SELECT (m.g_scrnalias)
  5421.  
  5422. *!*****************************************************************************
  5423. *!
  5424. *!       Function: SGN
  5425. *!
  5426. *!      Called by: FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  5427. *!
  5428. *!*****************************************************************************
  5429. FUNCTION sgn
  5430. PARAMETER num
  5431. DO CASE
  5432. CASE num = 0
  5433.    RETURN 0
  5434. CASE num > 0
  5435.    RETURN 1
  5436. CASE num < 0
  5437.    RETURN -1
  5438. ENDCASE
  5439.  
  5440.  
  5441. *
  5442. * repoObjects - Reposition objects to the relative positions on the new window.
  5443. *      This procedure assumes that the array objectpos is sorted on rows ([m.i, 2]).
  5444. *
  5445. *!*****************************************************************************
  5446. *!
  5447. *!      Procedure: REPOOBJECTS
  5448. *!
  5449. *!      Called by: CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  5450. *!
  5451. *!          Calls: GETLASTOBJECTLINE()(function  in TRANSPRT.PRG)
  5452. *!               : HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5453. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  5454. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5455. *!
  5456. *!*****************************************************************************
  5457. PROCEDURE repoobjects
  5458. PARAMETER m.windheight
  5459. PRIVATE m.windwidth, m.thermstep, m.rightalign, m.saverec, ;
  5460.    m.adjust, m.buttonadjust, m.numrb
  5461.  
  5462. m.saverec = RECNO()
  5463. m.windwidth = WIDTH
  5464. m.thermstep = 10 / m.objindex
  5465. STORE 0 TO m.adjust, m.buttonadjust, m.numrb
  5466.  
  5467. FOR m.i = 1 TO m.objindex
  5468.  
  5469.    IF objectpos[m.i,2] != m.curline
  5470.       IF m.numrb > 0
  5471.          m.adjust = m.adjust + c_vradbtn
  5472.          m.numrb = m.numrb - 1
  5473.       ENDIF
  5474.       m.adjust = m.adjust + m.buttonadjust
  5475.       STORE 0 TO m.buttonadjust
  5476.       m.curline = objectpos[m.i,2]
  5477.    ENDIF
  5478.  
  5479.    LOCATE FOR platform = m.g_toplatform AND uniqueid = objectpos[m.i,3]
  5480.    IF FOUND()
  5481.  
  5482.       g_lastobjectline[1] = getlastobjectline(g_lastobjectline[1], ;
  5483.          m.windheight * objectpos[m.i, 2] + m.adjust)
  5484.  
  5485.       REPLACE vpos WITH m.windheight * objectpos[m.i, 2] + m.adjust
  5486.  
  5487.       IF objectpos[m.i,5]
  5488.          m.rightalign = (m.windwidth * objectpos[m.i,1]) - WIDTH
  5489.          REPLACE hpos WITH IIF(m.rightalign < 0, 0, m.rightalign)
  5490.       ENDIF
  5491.  
  5492.       DO CASE
  5493.       CASE objectpos[m.i,4] = c_otfield
  5494.          REPLACE hpos WITH hpos + c_adjfld
  5495.  
  5496.       CASE objectpos[m.i,4] = c_otlist
  5497.          REPLACE vpos WITH vpos + c_vlist
  5498.          REPLACE height WITH height - c_listht
  5499.  
  5500.       CASE objectpos[m.i,4] = c_ottxtbut
  5501.          IF horizbutton(objectpos[m.i, 9])
  5502.             m.buttonadjust = c_adjtbtn
  5503.          ENDIF
  5504.  
  5505.       CASE objectpos[m.i,4] = c_otradbut
  5506.          IF m.buttonadjust < c_adjrbtn
  5507.             m.buttonadjust = c_adjrbtn
  5508.          ENDIF
  5509.          REPLACE vpos WITH vpos - c_vradbtn
  5510.  
  5511.       CASE objectpos[m.i,4] = c_otchkbox
  5512.          REPLACE vpos WITH vpos - c_vchkbox
  5513.  
  5514.       CASE objectpos[m.i,4] = c_otpopup
  5515.          REPLACE vpos WITH MAX(vpos + m.g_vpopup,0)
  5516.          REPLACE hpos WITH MAX(hpos + c_hpopup,0)
  5517.  
  5518.       CASE objectpos[m.i,4] = c_otbox
  5519.          DO adjbox WITH m.adjust
  5520.       ENDCASE
  5521.    ENDIF
  5522.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5523.    DO updtherm WITH m.g_mercury
  5524. ENDFOR
  5525. GOTO RECORD m.saverec
  5526.  
  5527. *
  5528. * adjItemsInBoxes - Adjust the location of objects within boxes
  5529. *
  5530. *!*****************************************************************************
  5531. *!
  5532. *!      Procedure: ADJITEMSINBOXES
  5533. *!
  5534. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5535. *!
  5536. *!          Calls: ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  5537. *!
  5538. *!*****************************************************************************
  5539. PROCEDURE adjitemsinboxes
  5540. PRIVATE m.subflag, m.emptybox, m.newlastline
  5541.  
  5542. DIMENSION boxdimension[4,2]
  5543. && 1 - Topmost
  5544. && 2 - Leftmost
  5545. && 3 - Bottommost
  5546. && 4 - Rightmost
  5547.  
  5548. SELECT (m.g_fromobjonlyalias)
  5549.  
  5550. SCAN FOR objtype = c_otbox AND HEIGHT != 1 AND WIDTH != 1
  5551.    STORE 999 TO boxdimension[1,1], boxdimension[2,1]
  5552.    STORE 0 TO boxdimension[3,1], boxdimension[4,1], boxdimension[4,2]
  5553.    STORE .F. TO m.subflag, m.emptybox, m.shrinkbox
  5554.  
  5555.    DO itemsinboxes WITH vpos, hpos, ;
  5556.       vpos + HEIGHT -1, hpos + WIDTH -1, m.emptybox, m.shrinkbox
  5557.  
  5558.    IF vpos + HEIGHT - 1 >= g_lastobjectline[1]
  5559.       m.newlastline = vpos + HEIGHT -1
  5560.       m.flag = .T.
  5561.       m.shrinkbox = .F.
  5562.    ELSE
  5563.       m.flag = .F.
  5564.    ENDIF
  5565.  
  5566.    boxdimension[1,1] = boxdimension[1,1] - vpos -.5
  5567.    boxdimension[2,1] = boxdimension[2,1] - hpos -.5
  5568.    boxdimension[3,1] = vpos + HEIGHT - 1 - boxdimension[3,1] - ;
  5569.       IIF(m.shrinkbox, .5 + m.g_vpopup, .5)
  5570.    boxdimension[4,1] = hpos + WIDTH - boxdimension[4,1] - 1.5
  5571.  
  5572.    SELECT (m.g_scrnalias)
  5573.    m.thisid = uniqueid
  5574.    LOCATE FOR uniqueid = m.thisid AND platform = m.g_toplatform
  5575.    IF FOUND() AND NOT m.emptybox
  5576.       REPLACE vpos WITH boxdimension[1,2] - boxdimension[1,1]
  5577.       REPLACE hpos WITH boxdimension[2,2] - boxdimension[2,1]
  5578.       REPLACE height WITH boxdimension[3,2] - vpos + boxdimension[3,1]
  5579.       REPLACE WIDTH WITH boxdimension[4,2] - hpos + boxdimension[4,1]
  5580.       IF m.flag AND vpos + HEIGHT >= g_lastobjectline[2]
  5581.          g_lastobjectline[1] = m.newlastline
  5582.          g_lastobjectline[2] = vpos + HEIGHT
  5583.       ENDIF
  5584.    ENDIF
  5585.  
  5586.    SELECT (m.g_fromobjonlyalias)
  5587.  
  5588. ENDSCAN
  5589. SELECT (m.g_scrnalias)
  5590.  
  5591. *
  5592. * itemsInBoxes - Adjust objects which are within a box
  5593. *
  5594. *!*****************************************************************************
  5595. *!
  5596. *!      Procedure: ITEMSINBOXES
  5597. *!
  5598. *!      Called by: ADJITEMSINBOXES    (procedure in TRANSPRT.PRG)
  5599. *!
  5600. *!          Calls: FINDOTHERSONLINE() (function  in TRANSPRT.PRG)
  5601. *!               : num2style()        (function  in TRANSPRT.PRG)
  5602. *!               : HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5603. *!               : GETOBJWIDTH()      (function  in TRANSPRT.PRG)
  5604. *!
  5605. *!           Uses: M.G_FROMOBJONLYALIA
  5606. *!
  5607. *!*****************************************************************************
  5608. PROCEDURE itemsinboxes
  5609. PARAMETER m.top, m.left, m.bottom, m.right, m.emptybox, m.shrinkbox
  5610. PRIVATE m.rec, m.wasapopup, m.oldbottom, m.newbottom, m.twidth
  5611.  
  5612. m.rec = RECNO()
  5613. m.g_boxeditemsalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  5614.  
  5615. SELECT vpos, hpos, HEIGHT, WIDTH, uniqueid, spacing, objtype, PICTURE, platform ;
  5616.    FROM (m.g_fromobjonlyalias) ;
  5617.    WHERE (vpos > m.top AND vpos < m.bottom) ;
  5618.    AND (hpos > m.left AND hpos < m.right) AND ;
  5619.    objtype <> c_otbox AND !(LEN(expr)=3 ;
  5620.    AND ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) >= 179 ;
  5621.     AND ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) <= 218);
  5622.    INTO CURSOR (m.g_boxeditemsalias)
  5623.  
  5624. STORE 0 TO m.oldbottom, m.newbottom
  5625. IF _TALLY > 0
  5626.    SET RELATION TO uniqueid+m.g_toplatform INTO (m.g_scrnalias) ADDITIVE
  5627.    LOCATE FOR .T.
  5628.    m.wasapopup = .F.
  5629.  
  5630.    DO WHILE NOT EOF()
  5631.       IF vpos < boxdimension[1,1] OR (m.wasapopup AND vpos = boxdimension[1,1])
  5632.          boxdimension[1,1] = vpos
  5633.          boxdimension[1,2] = &g_scrnalias..vpos
  5634.          IF objtype = c_otpopup
  5635.             m.wasapopup = .T.
  5636.          ELSE
  5637.             m.wasapopup = .F.
  5638.          ENDIF
  5639.       ENDIF
  5640.  
  5641.       IF hpos < boxdimension[2,1]
  5642.          boxdimension[2,1]= hpos
  5643.          boxdimension[2,2] = &g_scrnalias..hpos
  5644.       ENDIF
  5645.  
  5646.       DO CASE
  5647.       CASE objtype = c_ottext OR objtype = c_otchkbox ;
  5648.             OR (objtype = c_otfield AND height = 1)
  5649.          IF vpos > m.oldbottom
  5650.             m.shrinkbox = .F.
  5651.             IF !findothersonline(vpos, @m.newbottom, @m.oldbottom, objtype)
  5652.                m.oldbottom = vpos + HEIGHT
  5653.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5654.             ENDIF
  5655.          ENDIF
  5656.  
  5657.          * Check TXTWIDTH for text strings
  5658.          IF m.g_char2grph AND objtype = c_ottext
  5659.             m.twidth = TXTWIDTH(&g_scrnalias..expr,g_dfltfface,g_dfltfsize,num2style(g_boldstylenum))
  5660.          ELSE
  5661.             m.twidth = &g_scrnalias..width
  5662.          ENDIF
  5663.  
  5664.          IF &g_scrnalias..hpos + m.twidth > boxdimension[4,2]
  5665.             boxdimension[4,1] = hpos + WIDTH - 1
  5666.             boxdimension[4,2] = &g_scrnalias..hpos + m.twidth
  5667.          ENDIF
  5668.  
  5669.       CASE objtype = c_otradbut OR objtype = c_ottxtbut OR objtype = c_otinvbut
  5670.          m.numitems = OCCURS(';',PICTURE) + 1
  5671.  
  5672.          IF horizbutton(PICTURE)
  5673.  
  5674.             IF vpos > m.oldbottom
  5675.                m.shrinkbox = .F.
  5676.                IF findothersonline(vpos, @m.newbottom, @m.oldbottom, ;
  5677.                      objtype)
  5678.                   IF objtype = c_ottxtbut
  5679.                      REPLACE &g_scrnalias..vpos WITH &g_scrnalias..vpos - 0.312
  5680.                   ENDIF
  5681.                ENDIF
  5682.                m.oldbottom = vpos + HEIGHT - 1
  5683.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5684.             ENDIF
  5685.  
  5686.             IF (hpos -1 + (WIDTH +spacing) * m.numitems - spacing) >= ;
  5687.                   boxdimension[4,1]
  5688.                boxdimension[4,1] = hpos - 1 + ;
  5689.                   getobjwidth(objtype, ;
  5690.                   PICTURE, ;
  5691.                   WIDTH, ;
  5692.                   spacing, ;
  5693.                   m.g_toplatform)
  5694.                boxdimension[4,2] = &g_scrnalias..hpos + ;
  5695.                   getobjwidth(&g_scrnalias..objtype, ;
  5696.                   &g_scrnalias..picture, ;
  5697.                   &g_scrnalias..width, ;
  5698.                   &g_scrnalias..spacing, ;
  5699.                   m.g_toplatform)
  5700.             ENDIF
  5701.  
  5702.          ELSE
  5703.             m.shrinkbox = .F.
  5704.             IF (vpos -1 + m.numitems + (spacing * (m.numitems -1))) >= ;
  5705.                   m.oldbottom
  5706.                m.oldbottom = vpos -1 + m.numitems + ;
  5707.                   (spacing * (m.numitems -1)) - 1
  5708.                m.newbottom = &g_scrnalias..vpos  + m.numitems + ;
  5709.                   (&g_scrnalias..spacing * (m.numitems -1))
  5710.             ENDIF
  5711.  
  5712.             IF hpos -1 + WIDTH >= boxdimension[4,1]
  5713.                boxdimension[4,1] = hpos -1 + WIDTH
  5714.                boxdimension[4,2] = &g_scrnalias..hpos  + ;
  5715.                   &g_scrnalias..width
  5716.             ENDIF
  5717.          ENDIF
  5718.  
  5719.       CASE objtype = c_otpopup
  5720.          IF vpos + HEIGHT - 2 > m.oldbottom
  5721.             IF !findothersonline(vpos + 1, @m.newbottom, @m.oldbottom, objtype)
  5722.                m.oldbottom = vpos + HEIGHT - 2
  5723.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5724.             ENDIF
  5725.             m.shrinkbox = IIF(m.bottom -1 = vpos + HEIGHT -1, .T., .F.)
  5726.          ENDIF
  5727.  
  5728.          IF hpos + WIDTH - 1 > boxdimension[4,1]
  5729.             boxdimension[4,1] = hpos + WIDTH - 1
  5730.             boxdimension[4,2] = &g_scrnalias..hpos + &g_scrnalias..width
  5731.          ENDIF
  5732.  
  5733.       CASE objtype = c_otfield OR ;
  5734.             objtype = c_otlist OR objtype = c_otbox
  5735.  
  5736.          IF vpos + HEIGHT - 1 > m.oldbottom
  5737.             m.shrinkbox = .F.
  5738.             IF !findothersonline(vpos, @m.newbottom, @m.oldbottom, objtype)
  5739.                m.oldbottom = vpos + HEIGHT - 1
  5740.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5741.             ENDIF
  5742.          ENDIF
  5743.  
  5744.          IF hpos + WIDTH - 1 > boxdimension[4,1]
  5745.             boxdimension[4,1] = hpos + WIDTH - 1
  5746.             boxdimension[4,2] = &g_scrnalias..hpos + &g_scrnalias..width
  5747.          ENDIF
  5748.  
  5749.       ENDCASE
  5750.       SKIP
  5751.    ENDDO
  5752.  
  5753.    m.emptybox = .F.
  5754.    boxdimension[3,1] = m.oldbottom
  5755.    boxdimension[3,2] = m.newbottom
  5756. ELSE
  5757.    m.emptybox = .T.
  5758. ENDIF
  5759.  
  5760. USE
  5761. SELECT (m.g_fromobjonlyalias)
  5762. GOTO RECORD m.rec
  5763. RETURN
  5764.  
  5765. *
  5766. * findOthersOnLine - Find any other objects in the box and on the line with a text button
  5767. *
  5768. *!*****************************************************************************
  5769. *!
  5770. *!       Function: FINDOTHERSONLINE
  5771. *!
  5772. *!      Called by: ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  5773. *!
  5774. *!*****************************************************************************
  5775. FUNCTION findothersonline
  5776. PARAMETER m.lineno, m.newbottom, m.oldbottom, m.curtype
  5777. PRIVATE m.saverec, m.prevtype, m.flag
  5778.  
  5779. m.prevtype = 0
  5780. m.flag = .F.
  5781. m.saverec = RECNO()
  5782. LOCATE FOR (objtype != c_otpopup AND vpos = m.lineno) OR ;
  5783.    (m.curtype != c_otpopup AND objtype = c_otpopup AND m.lineno = vpos + 1)
  5784.  
  5785. IF !FOUND()
  5786.    GOTO RECORD (m.saverec)
  5787.    RETURN m.flag
  5788. ENDIF
  5789.  
  5790. DO WHILE FOUND()
  5791.    DO CASE
  5792.    CASE objtype = c_ottxtbut
  5793.       IF m.curtype != objtype
  5794.          m.flag = .T.
  5795.          m.oldbottom = vpos + HEIGHT -1
  5796.          m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5797.          GOTO RECORD (m.saverec)
  5798.          RETURN m.flag
  5799.       ENDIF
  5800.  
  5801.    CASE objtype = c_otpopup
  5802.       m.flag = .T.
  5803.       m.oldbottom = vpos + HEIGHT - 2
  5804.       m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5805.       m.prevtype = c_otpopup
  5806.  
  5807.    CASE (objtype = c_otfield OR objtype = c_otlist OR objtype = c_otline) AND ;
  5808.          (m.prevtype != c_otpopup)
  5809.       m.flag = .T.
  5810.       m.oldbottom = vpos + HEIGHT - 1
  5811.       m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5812.       m.prevtype = objtype
  5813.  
  5814.    OTHERWISE
  5815.       m.flag = .T.
  5816.       m.oldbottom = vpos
  5817.       m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5818.  
  5819.    ENDCASE
  5820.  
  5821.    CONTINUE
  5822. ENDDO
  5823. GOTO RECORD (m.saverec)
  5824. RETURN m.flag
  5825.  
  5826. *
  5827. * StretchLinesToBorders - This procedure makes sure that any lines which stretched to the
  5828. *      edge of the from platform window will stretch to the edge of the to platform window.
  5829. *
  5830. *!*****************************************************************************
  5831. *!
  5832. *!      Procedure: ADJINVBTNS
  5833. *!
  5834. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5835. *!
  5836. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5837. *!               : ADJPOSTINV         (procedure in TRANSPRT.PRG)
  5838. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5839. *!
  5840. *!*****************************************************************************
  5841. PROCEDURE adjinvbtns
  5842. PRIVATE m.saverec, m.loop, m.horizontal, m.btnid, m.objid, m.flag, m.thermstep, m.leftmost, ;
  5843.    m.label, m.btnvpos, m.btnhpos, m.btnwidth, m.btnheight, m.btnspacing, m.btncount, ;
  5844.    m.ybtn, m.vbtn, m.xbtn, m.hbtn, m.defwidth, m.defwidthindex, m.defheight, m.defheightindex, ;
  5845.    m.topmargin, m.bottommargin, m.leftmargin, m.rightmargin, m.adjustment, m.totadjust, m.newhpos
  5846.  
  5847. m.saverec = RECNO()
  5848. m.totadjust = 0
  5849. m.leftmost = 0
  5850.  
  5851. COUNT TO m.thermstep FOR platform = m.g_fromplatform AND objtype = c_otinvbut
  5852. m.thermstep = 5/m.thermstep
  5853.  
  5854. SCAN FOR platform = m.g_fromplatform AND objtype = c_otinvbut
  5855.    m.horizontal = horizbutton(PICTURE)
  5856.    m.btnvpos = vpos
  5857.    m.btnhpos = hpos
  5858.    m.btnheight = HEIGHT
  5859.    m.btnwidth = WIDTH
  5860.    m.btnspacing = spacing
  5861.    m.btncount = OCCURS(";", PICTURE) + 1
  5862.    m.btnid = uniqueid
  5863.  
  5864.    STORE 0 TO m.defwidth, m.defwidthindex, m.defheight, m.defheightindex
  5865.  
  5866.    * This array is used to keep track of the rectangle which bounds the objects which
  5867.    * lie on top of each invisible button in the set.
  5868.    *
  5869.    *   sizes[x,1] = Minimum row on the FROM platform.
  5870.    *   sizes[x,2] = Minimum colum on the FROM platform.
  5871.    *   sizes[x,3] = Maximum row on the FROM platform.
  5872.    *   sizes[x,4] = Maximum colum on the FROM platform.
  5873.    *   sizes[x,5] = Minimum row on the TO platform.
  5874.    *   sizes[x,6] = Minimum colum on the TO platform.
  5875.    *   sizes[x,7] = Maximum row on the TO platform.
  5876.    *   sizes[x,8] = Maximum colum on the TO platform.
  5877.    *   sizes[x,9] = Comma delimeted list of uniqueid's for objects positioned on
  5878.    *               the button face.
  5879.    DIMENSION sizes[m.btnCount,9]
  5880.  
  5881.    FOR m.loop = 1 TO m.btncount
  5882.       m.ybtn = IIF(m.horizontal, m.btnvpos, m.btnvpos + ((m.loop-1) * m.btnheight) + ((m.loop-1) * m.btnspacing))
  5883.       m.vbtn = m.ybtn + m.btnheight
  5884.       m.xbtn = IIF(m.horizontal, m.btnhpos + ((m.loop-1) * m.btnwidth) + ((m.loop-1) * m.btnspacing), m.btnhpos)
  5885.       m.hbtn = m.xbtn + m.btnwidth
  5886.  
  5887.       STORE 0 TO sizes[m.loop,3], sizes[m.loop,4], sizes[m.loop,7], sizes[m.loop,8]
  5888.       STORE 99999999 TO sizes[m.loop,1], sizes[m.loop,2], sizes[m.loop,5], sizes[m.loop,6]
  5889.  
  5890.       sizes[m.loop,9] = ""
  5891.  
  5892.       SCAN FOR platform = m.g_fromplatform AND (objtype = c_ottext OR objtype = c_otfield  OR ;
  5893.             objtype = c_otbox OR objtype = c_otline) AND ;
  5894.             vpos >= m.ybtn AND vpos+HEIGHT <= m.vbtn AND hpos >= m.xbtn AND hpos+WIDTH <= m.hbtn
  5895.          m.objid = uniqueid
  5896.          sizes[m.loop,1] = MIN(sizes[m.loop,1], vpos)
  5897.          sizes[m.loop,2] = MIN(sizes[m.loop,2], hpos)
  5898.          sizes[m.loop,3] = MAX(sizes[m.loop,3], vpos+HEIGHT)
  5899.          sizes[m.loop,4] = MAX(sizes[m.loop,4], hpos+WIDTH)
  5900.          sizes[m.loop,9] = sizes[m.loop,9] + ;
  5901.             IIF(LEN(sizes[m.loop,9]) = 0, uniqueid, ","+uniqueid)
  5902.  
  5903.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  5904.          IF FOUND()
  5905.             sizes[m.loop,5] = MIN(sizes[m.loop,5], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5906.                vpos-c_adjbox, vpos))
  5907.             sizes[m.loop,6] = MIN(sizes[m.loop,6], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5908.                hpos-c_adjbox, hpos))
  5909.             sizes[m.loop,7] = MAX(sizes[m.loop,7], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5910.                vpos+HEIGHT+c_adjbox, vpos+HEIGHT))
  5911.             sizes[m.loop,8] = MAX(sizes[m.loop,8], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5912.                hpos+WIDTH+c_adjbox, hpos+WIDTH))
  5913.          ENDIF
  5914.  
  5915.          LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.objid
  5916.       ENDSCAN
  5917.  
  5918.       * The tallest button region will define where the button set gets
  5919.       * placed so we want to remember which region that was.
  5920.       IF (sizes[m.loop,7] - sizes[m.loop,5]) > m.defheight
  5921.          m.defheight      = sizes[m.loop,7] - sizes[m.loop,5]
  5922.          m.defheightindex = m.loop
  5923.          m.topmargin      = sizes[m.loop,1] - m.ybtn
  5924.          m.bottommargin   = m.vbtn - sizes[m.loop,3]
  5925.       ENDIF
  5926.  
  5927.       * The widest button region will define where the button set gets
  5928.       * placed so we want to remember which region that was.
  5929.       IF (sizes[m.loop,8] - sizes[m.loop,6]) > m.defwidth
  5930.          m.defwidth      = sizes[m.loop,8] - sizes[m.loop,6]
  5931.          m.defwidthindex = m.loop
  5932.          m.leftmargin    = sizes[m.loop,2] - m.xbtn
  5933.          m.rightmargin   = m.hbtn - sizes[m.loop,4]
  5934.       ENDIF
  5935.    ENDFOR
  5936.  
  5937.    IF m.defheightindex != 0 AND m.defwidthindex != 0
  5938.       LOCATE FOR platform = m.g_toplatform AND uniqueid = m.btnid
  5939.       IF FOUND()
  5940.          IF m.horizontal
  5941.             REPLACE vpos WITH sizes[m.defHeightIndex,5] - m.topmargin
  5942.          ELSE
  5943.             REPLACE hpos WITH sizes[m.defWidthIndex,6] - m.leftmargin
  5944.          ENDIF
  5945.  
  5946.          REPLACE height WITH (sizes[m.defHeightIndex,7] - sizes[m.defHeightIndex,5]) + m.topmargin + m.bottommargin
  5947.          REPLACE WIDTH WITH (sizes[m.defWidthIndex,8] - sizes[m.defWidthIndex,6]) + m.leftmargin + m.rightmargin
  5948.       ENDIF
  5949.  
  5950.       IF m.horizontal AND WIDTH > m.btnwidth
  5951.          m.adjustment = WIDTH - m.btnwidth
  5952.          IF spacing > 1
  5953.             IF m.adjustment <= spacing-1
  5954.                REPLACE spacing WITH spacing - m.adjustment
  5955.             ELSE
  5956.                m.adjustment = m.adjustment - (spacing-1)
  5957.                REPLACE spacing WITH 1
  5958.                m.leftmost = MAX(m.leftmost, hpos + (m.btncount*WIDTH) + ((m.btncount-1)*spacing))
  5959.  
  5960.                m.totadjust = MAX(m.totadjust, m.btncount * m.adjustment)
  5961.  
  5962.                DO adjpostinv WITH vpos, vpos+HEIGHT, ;
  5963.                   m.btnhpos + (m.btncount*m.btnwidth) + ((m.btncount-1)*m.btnspacing), ;
  5964.                   m.btncount * m.adjustment
  5965.  
  5966.                FOR m.loop = 2 TO m.btncount
  5967.                   DO WHILE LEN(sizes[m.loop,9]) > 0
  5968.                      IF AT(",", sizes[m.loop,9]) != 0
  5969.                         m.label = LEFT(sizes[m.loop,9], AT(",", sizes[m.loop,9])-1)
  5970.                         sizes[m.loop,9] = SUBSTR(sizes[m.loop,9], AT(",", sizes[m.loop,9])+1)
  5971.                      ELSE
  5972.                         m.label = sizes[m.loop,9]
  5973.                         sizes[m.loop,9] = ""
  5974.                      ENDIF
  5975.  
  5976.                      LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.label
  5977.                      IF FOUND()
  5978.                         m.newhpos = hpos + (m.adjustment * (m.loop-1))
  5979.                         LOCATE FOR platform = m.g_toplatform AND uniqueid = m.label
  5980.                         IF FOUND()
  5981.                            REPLACE hpos WITH IIF(objtype = c_otbox OR objtype = c_otline, ;
  5982.                               m.newhpos+c_adjbox, m.newhpos)
  5983.                         ENDIF
  5984.                      ENDIF
  5985.                   ENDDO
  5986.                ENDFOR
  5987.             ENDIF
  5988.          ENDIF
  5989.       ENDIF
  5990.    ENDIF
  5991.  
  5992.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  5993.    IF FOUND()
  5994.       IF m.totadjust > 0
  5995.          REPLACE WIDTH WITH WIDTH + m.totadjust
  5996.       ENDIF
  5997.  
  5998.       IF WIDTH < m.leftmost
  5999.          REPLACE WIDTH WITH m.leftmost + 1
  6000.       ENDIF
  6001.    ENDIF
  6002.  
  6003.  
  6004.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  6005.    DO updtherm WITH m.g_mercury
  6006.  
  6007.    LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.btnid
  6008. ENDSCAN
  6009.  
  6010. IF m.saverec <= RECCOUNT()
  6011.    GOTO RECORD (m.saverec)
  6012. ELSE
  6013.    LOCATE FOR .F.
  6014. ENDIF
  6015.  
  6016. *
  6017. * adjPostInv - This procedure moves objects which lie to the right of a set of horizontal
  6018. *      invisible buttons so that they won't overlap.
  6019. *
  6020. *!*****************************************************************************
  6021. *!
  6022. *!      Procedure: ADJPOSTINV
  6023. *!
  6024. *!      Called by: ADJINVBTNS         (procedure in TRANSPRT.PRG)
  6025. *!
  6026. *!          Calls: FINDALIGNEND()     (function  in TRANSPRT.PRG)
  6027. *!
  6028. *!*****************************************************************************
  6029. PROCEDURE adjpostinv
  6030. PARAMETER m.ystart, m.yend, m.xstart, m.adjustment
  6031. PRIVATE m.saverec, m.saveid
  6032.  
  6033. m.saverec = RECNO()
  6034.  
  6035. m.ystart = findalignend(m.ystart, m.xstart, -1)
  6036. m.yend = findalignend(m.yend, m.xstart, 1)
  6037.  
  6038. SCAN FOR platform = m.g_fromplatform AND hpos >= m.xstart AND vpos >= m.ystart AND vpos <= m.yend AND ;
  6039.       (objtype = c_ottext   OR objtype = c_otline   OR objtype = c_otbox   OR objtype = c_list OR ;
  6040.       objtype = c_otradbut OR objtype = c_otchkbox OR objtype = c_otfield OR objtype = c_popup OR ;
  6041.       objtype = c_otinvbut)
  6042.    m.saveid = uniqueid
  6043.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.saveid
  6044.    IF FOUND()
  6045.       REPLACE hpos WITH hpos + m.adjustment
  6046.    ENDIF
  6047.  
  6048.    LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.saveid
  6049. ENDSCAN
  6050.  
  6051. IF m.saverec <= RECCOUNT()
  6052.    GOTO RECORD m.saverec
  6053. ELSE
  6054.    LOCATE FOR .F.
  6055. ENDIF
  6056.  
  6057. *
  6058. * FindAlignEnd - Given a position to start with and a direction, this routine looks for the
  6059. *      last line where right aligned objects extend to from the starting position.
  6060. *
  6061. *!*****************************************************************************
  6062. *!
  6063. *!       Function: FINDALIGNEND
  6064. *!
  6065. *!      Called by: ADJPOSTINV         (procedure in TRANSPRT.PRG)
  6066. *!
  6067. *!*****************************************************************************
  6068. FUNCTION findalignend
  6069. PARAMETER m.ystart, m.xstart, m.increment
  6070. PRIVATE m.saverec, m.ytemp, m.xtemp, m.result
  6071.  
  6072. m.result = m.ystart
  6073.  
  6074. SCAN FOR platform = m.g_fromplatform AND hpos >= m.xstart AND vpos = m.ystart
  6075.    m.saverec = RECNO()
  6076.  
  6077.    m.ytemp = vpos + m.increment
  6078.    m.xtemp = hpos
  6079.    LOCATE FOR platform = m.g_fromplatform AND vpos = m.ytemp AND hpos = m.xtemp AND ;
  6080.       (objtype = c_ottext   OR objtype = c_otline   OR objtype = c_otbox   OR objtype = c_list OR ;
  6081.       objtype = c_otradbut OR objtype = c_otchkbox OR objtype = c_otfield OR objtype = c_popup OR ;
  6082.       objtype = c_otinvbut)
  6083.    DO WHILE FOUND()
  6084.       m.result = IIF(m.increment < 0, MIN(m.result, m.ytemp), MAX(m.result, m.ytemp))
  6085.       m.ytemp = m.ytemp + m.increment
  6086.       LOCATE FOR platform = m.g_fromplatform AND vpos = m.ytemp AND hpos = m.xtemp AND ;
  6087.          (objtype = c_ottext   OR objtype = c_otline   OR objtype = c_otbox   OR objtype = c_list OR ;
  6088.          objtype = c_otradbut OR objtype = c_otchkbox OR objtype = c_otfield OR objtype = c_popup OR ;
  6089.          objtype = c_otinvbut)
  6090.    ENDDO
  6091.    GOTO RECORD m.saverec
  6092. ENDSCAN
  6093.  
  6094. RETURN m.result
  6095.  
  6096. *
  6097. * StretchLinesToBorders - This procedure makes sure that any lines which stretched to the
  6098. *      edge of the from platform window will stretch to the edge of the to platform window.
  6099. *
  6100. *!*****************************************************************************
  6101. *!
  6102. *!      Procedure: STRETCHLINESTOBORDERS
  6103. *!
  6104. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  6105. *!
  6106. *!*****************************************************************************
  6107. PROCEDURE stretchlinestoborders
  6108. PRIVATE m.saverec, m.objid, m.objrec, m.objwidth, m.fromheight, m.fromwidth
  6109.  
  6110. IF m.g_filetype = c_report OR m.g_filetype = c_label
  6111.    RETURN
  6112. ENDIF
  6113.  
  6114. m.saverec = RECNO()
  6115.  
  6116. LOCATE FOR platform = m.g_fromplatform AND objtype = c_otheader
  6117. IF FOUND()
  6118.    IF BORDER = 0 OR STYLE = 0
  6119.       m.fromheight = HEIGHT
  6120.       m.fromwidth = WIDTH
  6121.    ELSE
  6122.       m.fromheight = HEIGHT - 2
  6123.       m.fromwidth = WIDTH - 2
  6124.    ENDIF
  6125.  
  6126.    SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND ;
  6127.          ((WIDTH = 1 AND vpos+HEIGHT = m.fromheight) OR (HEIGHT = 1 AND hpos+WIDTH = m.fromwidth))
  6128.  
  6129.       m.objrec = RECNO()
  6130.       m.objid = uniqueid
  6131.       m.objwidth = WIDTH
  6132.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6133.       IF FOUND()
  6134.          m.toheight = HEIGHT
  6135.          m.towidth = WIDTH
  6136.  
  6137.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6138.          IF FOUND()
  6139.             IF m.objwidth = 1
  6140.                REPLACE height WITH m.toheight-vpos
  6141.             ELSE
  6142.                REPLACE WIDTH WITH m.towidth-hpos
  6143.             ENDIF
  6144.          ENDIF
  6145.       ENDIF
  6146.  
  6147.       GOTO RECORD m.objrec
  6148.    ENDSCAN
  6149. ENDIF
  6150.  
  6151. IF m.saverec > RECCOUNT()
  6152.    LOCATE FOR .F.
  6153. ELSE
  6154.    GOTO RECORD m.saverec
  6155. ENDIF
  6156. RETURN
  6157.  
  6158. *
  6159. * JoinLines -This procedure examines each line to see where it meets other lines in the
  6160. *      from platform and constructs an array of these positons.  This array can then
  6161. *      be used to make the lines/boxes meet in the from platform.
  6162. *
  6163. *!*****************************************************************************
  6164. *!
  6165. *!      Procedure: JOINLINES
  6166. *!
  6167. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  6168. *!
  6169. *!          Calls: UPDTHERM           (procedure in TRANSPRT.PRG)
  6170. *!               : JOINHORIZONTAL     (procedure in TRANSPRT.PRG)
  6171. *!               : JOINVERTICAL       (procedure in TRANSPRT.PRG)
  6172. *!               : MEETBOXCHAR        (procedure in TRANSPRT.PRG)
  6173. *!               : ZAPBOXCHAR         (procedure in TRANSPRT.PRG)
  6174. *!               : REJOINBOXES        (procedure in TRANSPRT.PRG)
  6175. *!
  6176. *!*****************************************************************************
  6177. PROCEDURE joinlines
  6178. PRIVATE m.saverec, m.joincount, m.linerec, m.lineid, m.i, m.thermstep, ;
  6179.    m.objvpos, m.objhpos, m.objright, m.objbottom, m.objid, m.objrec, m.objcode, ;
  6180.    m.fromvpos, m.fromhpos, m.fromheight, m.fromwidth, m.fromend, m.fromcode, ;
  6181.    m.tovpos, m.tohpos, m.toheight, m.towidth, ;
  6182.    m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6183.  
  6184. DIMENSION joins[1,5]
  6185. && Joins[X,2] - toVpos
  6186. && Joins[X,3] - toHpos
  6187. && Joins[X,4] - Vpos match level
  6188. && Joins[X,5] - Hpos match level
  6189. m.joincount = 0
  6190. m.saverec = RECNO()
  6191.  
  6192. COUNT TO m.thermstep FOR platform = m.g_fromplatform AND objtype = c_otbox AND (WIDTH=1 OR HEIGHT=1)
  6193. IF m.thermstep <> 0
  6194.    m.thermstep = 10 / m.thermstep
  6195. ELSE
  6196.    m.g_mercury = MIN(m.g_mercury + 10, 95)
  6197.    DO updtherm WITH m.g_mercury
  6198. ENDIF
  6199.  
  6200. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND (WIDTH=1 OR HEIGHT=1)
  6201.    m.fromvpos = vpos
  6202.    m.fromhpos = hpos
  6203.    m.fromheight = HEIGHT
  6204.    m.fromwidth = WIDTH
  6205.    m.fromcode = objcode
  6206.    m.lineid = uniqueid
  6207.    m.linerec = RECNO()
  6208.  
  6209.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.lineid
  6210.    IF FOUND()
  6211.       m.tovpos = vpos
  6212.       m.tohpos = hpos
  6213.       m.toheight = HEIGHT
  6214.       m.towidth = WIDTH
  6215.  
  6216.       SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND uniqueid <> m.lineid
  6217.          IF m.fromheight = 1 AND HEIGHT <> 1 AND (m.fromvpos >= vpos AND m.fromvpos <= vpos+HEIGHT-1)
  6218.             m.fromend = m.fromhpos + m.fromwidth - 1
  6219.  
  6220.             ** Horizontal line which starts on a vertical line/box side.
  6221.             IF m.fromhpos = hpos OR m.fromhpos = hpos+WIDTH-1
  6222.                DO joinhorizontal WITH m.fromvpos, m.fromhpos, m.fromhpos, m.tovpos, m.toheight, m.fromcode
  6223.             ENDIF
  6224.  
  6225.             ** Horizontal line which ends on a vertical line/box side.
  6226.             IF m.fromend = hpos OR m.fromend = hpos+WIDTH-1
  6227.                DO joinhorizontal WITH m.fromvpos, m.fromend, m.fromend, m.tovpos, m.toheight, m.fromcode
  6228.             ENDIF
  6229.  
  6230.             ** Horizontal line which starts one to the right of a vertical line/box side
  6231.             IF m.fromhpos-1 = hpos OR m.fromhpos = hpos+WIDTH
  6232.                DO joinhorizontal WITH m.fromvpos, m.fromhpos-1, m.fromhpos, m.tovpos, m.toheight, m.fromcode
  6233.             ENDIF
  6234.  
  6235.             ** Horizontal line which ends one left of a vertical line/box side
  6236.             IF m.fromend+1 = hpos OR  m.fromend = hpos+WIDTH-2
  6237.                DO joinhorizontal WITH m.fromvpos, m.fromend+1, m.fromend, m.tovpos, m.toheight, m.fromcode
  6238.             ENDIF
  6239.          ENDIF
  6240.  
  6241.          IF m.fromwidth = 1 AND WIDTH <> 1 AND (m.fromhpos >= hpos AND m.fromhpos <= hpos+WIDTH-1)
  6242.             m.fromend = m.fromvpos + m.fromheight - 1
  6243.  
  6244.             ** Vertical line which starts on a horizontical line/box side.
  6245.             IF m.fromvpos = vpos OR m.fromvpos = vpos+HEIGHT-1
  6246.                DO joinvertical WITH m.fromvpos, m.fromvpos, m.fromhpos, m.tohpos, m.fromcode
  6247.             ENDIF
  6248.  
  6249.             ** Vertical line which ends on a horizontical line/box side.
  6250.             IF m.fromend = vpos OR m.fromend = vpos+HEIGHT-1
  6251.                DO joinvertical WITH m.fromend, m.fromend, m.fromhpos, m.tohpos, m.fromcode
  6252.             ENDIF
  6253.  
  6254.             ** Vertical line which starts one below a horizontal line/box side
  6255.             IF m.fromvpos-1 = vpos OR m.fromvpos = vpos+HEIGHT
  6256.                DO joinvertical WITH m.fromvpos-1, m.fromvpos, m.fromhpos, m.tohpos, m.fromcode
  6257.             ENDIF
  6258.  
  6259.             ** Vertical line which ends one above a horizontal line/box side
  6260.             IF m.fromend+1 = vpos OR m.fromend = vpos+HEIGHT-2
  6261.                DO joinvertical WITH m.fromend+1, m.fromend, m.fromhpos, m.tohpos, m.fromcode
  6262.             ENDIF
  6263.          ENDIF
  6264.       ENDSCAN
  6265.    ENDIF
  6266.  
  6267.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  6268.    DO updtherm WITH m.g_mercury
  6269.  
  6270.    GOTO RECORD m.linerec
  6271. ENDSCAN
  6272.  
  6273. DO meetboxchar
  6274. DO zapboxchar
  6275.  
  6276. m.thermstep = 10/m.joincount
  6277. FOR m.i = 1 TO m.joincount
  6278.    DO rejoinboxes WITH VAL(LEFT(joins[m.i, 1], 3)), VAL(RIGHT(joins[m.i, 1], 3)), joins[m.i, 2], joins[m.i, 3]
  6279.  
  6280.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  6281.    DO updtherm WITH m.g_mercury
  6282. ENDFOR
  6283.  
  6284. IF m.saverec > RECCOUNT()
  6285.    LOCATE FOR .F.
  6286. ELSE
  6287.    GOTO RECORD m.saverec
  6288. ENDIF
  6289. RETURN
  6290.  
  6291. *
  6292. * joinHorizontal - This procedure adds a join for a horizontal line which has been determined to
  6293. *               intersect something vertical.
  6294. *
  6295. *!*****************************************************************************
  6296. *!
  6297. *!      Procedure: JOINHORIZONTAL
  6298. *!
  6299. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6300. *!
  6301. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6302. *!               : ADDJOIN            (procedure in TRANSPRT.PRG)
  6303. *!
  6304. *!*****************************************************************************
  6305. PROCEDURE joinhorizontal
  6306. PARAMETER m.fromvpos, m.oldhpos1, m.oldhpos2, m.tovpos, m.tothickness, m.fromcode
  6307. PRIVATE m.objvpos, m.objhpos, m.objright, m.objbottom, m.objcode, m.objid, m.objrec
  6308.  
  6309. m.objvpos = vpos
  6310. m.objhpos = hpos
  6311. m.objright = hpos + WIDTH - 1
  6312. m.objbottom = vpos + HEIGHT - 1
  6313. m.objcode = objcode
  6314. m.objid = uniqueid
  6315. m.objrec = RECNO()
  6316.  
  6317. LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6318. IF FOUND()
  6319.    DO CASE
  6320.    CASE m.fromvpos = m.objvpos OR m.fromvpos = m.objbottom
  6321.       IF objtype = c_otline
  6322.          m.joinvpos = m.tovpos - c_adjbox + (m.tothickness/2)
  6323.          STORE 2 TO m.vlevel, m.hlevel
  6324.       ELSE
  6325.          IF m.fromvpos = m.objvpos
  6326.             m.joinvpos = vpos - c_adjbox + (getlinewidth(m.objcode, .T.)/2)
  6327.          ELSE
  6328.             m.joinvpos = vpos+HEIGHT - c_adjbox - (getlinewidth(m.objcode, .T.)/2)
  6329.          ENDIF
  6330.          STORE 4 TO m.vlevel, m.hlevel
  6331.       ENDIF
  6332.  
  6333.    OTHERWISE
  6334.       m.joinvpos = m.tovpos - c_adjbox + (getlinewidth(m.fromcode, .T.)/2)
  6335.       m.vlevel = 0
  6336.       m.hlevel = IIF(objtype = c_otline, 1, 3)
  6337.    ENDCASE
  6338.  
  6339.    IF m.oldhpos1 = m.objhpos OR objtype = c_otline
  6340.       m.joinhpos = hpos - c_adjbox + (getlinewidth(m.objcode, .F.)/2)
  6341.    ELSE
  6342.       m.joinhpos = hpos+WIDTH - c_adjbox - (getlinewidth(m.objcode, .F.)/2)
  6343.    ENDIF
  6344.  
  6345.    DO addjoin WITH m.fromvpos, m.oldhpos1, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6346.    IF m.oldhpos1 <> m.oldhpos2
  6347.       DO addjoin WITH m.fromvpos, m.oldhpos2, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6348.    ENDIF
  6349. ENDIF
  6350.  
  6351. GOTO RECORD m.objrec
  6352. RETURN
  6353.  
  6354. *
  6355. * joinVertical - This procedure adds a join for a vertical line which has been determined to
  6356. *               intersect something horizontal.
  6357. *
  6358. *!*****************************************************************************
  6359. *!
  6360. *!      Procedure: JOINVERTICAL
  6361. *!
  6362. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6363. *!
  6364. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6365. *!               : ADDJOIN            (procedure in TRANSPRT.PRG)
  6366. *!
  6367. *!*****************************************************************************
  6368. PROCEDURE joinvertical
  6369. PARAMETER m.oldvpos1, m.oldvpos2, m.fromhpos, m.tohpos, m.fromcode
  6370. PRIVATE m.objvpos, m.objhpos, m.objright, m.objbottom, m.objcode, m.objid, m.objrec
  6371.  
  6372. m.objvpos = vpos
  6373. m.objhpos = hpos
  6374. m.objright = hpos + WIDTH - 1
  6375. m.objbottom = vpos + HEIGHT - 1
  6376. m.objcode = objcode
  6377. m.objid = uniqueid
  6378. m.objrec = RECNO()
  6379.  
  6380. LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6381. IF FOUND()
  6382.    DO CASE
  6383.    CASE m.fromhpos = m.objhpos OR m.fromhpos = m.objright
  6384.       IF objtype = c_otline
  6385.          m.joinhpos = IIF(m.fromhpos = m.objhpos, hpos, hpos+WIDTH-1)
  6386.          STORE 2 TO m.vlevel, m.hlevel
  6387.       ELSE
  6388.          IF m.fromhpos = m.objhpos
  6389.             m.joinhpos = hpos - c_adjbox + (getlinewidth(m.objcode, .F.)/2)
  6390.          ELSE
  6391.             m.joinhpos = hpos+WIDTH - c_adjbox - (getlinewidth(m.objcode, .F.)/2)
  6392.          ENDIF
  6393.          STORE 4 TO m.vlevel, m.hlevel
  6394.       ENDIF
  6395.  
  6396.    OTHERWISE
  6397.       m.joinhpos = m.tohpos - c_adjbox + (getlinewidth(m.fromcode, .F.)/2)
  6398.       m.vlevel = IIF(objtype = c_otline, 1, 3)
  6399.       m.hlevel = 0
  6400.    ENDCASE
  6401.  
  6402.    IF m.oldvpos1 = m.objvpos OR objtype = c_otline
  6403.       m.joinvpos = vpos - c_adjbox + (getlinewidth(m.objcode, .T.)/2)
  6404.    ELSE
  6405.       m.joinvpos = vpos+HEIGHT - c_adjbox - (getlinewidth(m.objcode, .T.)/2)
  6406.    ENDIF
  6407.  
  6408.    DO addjoin WITH m.oldvpos1, m.fromhpos, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6409.    IF m.oldvpos1 <> m.oldvpos2
  6410.       DO addjoin WITH m.oldvpos2, m.fromhpos, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6411.    ENDIF
  6412. ENDIF
  6413. GOTO RECORD m.objrec
  6414.  
  6415. *
  6416. * MeetBoxChar - This procedure looks at suspected box join characters and adds a join position for each
  6417. *            line which ends one short of it.
  6418. *
  6419. *!*****************************************************************************
  6420. *!
  6421. *!      Procedure: MEETBOXCHAR
  6422. *!
  6423. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6424. *!
  6425. *!          Calls: ADDJOIN            (procedure in TRANSPRT.PRG)
  6426. *!
  6427. *!*****************************************************************************
  6428. PROCEDURE meetboxchar
  6429. PRIVATE m.saverec, m.fromvpos, m.fromhpos, m.tovpos, m.tohpos, m.joinrec, m.joinid
  6430. m.saverec = RECNO()
  6431.  
  6432. SCAN FOR platform = m.g_fromplatform AND objtype = c_ottext AND LEN(expr)=3 AND ;
  6433.       ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) >= 179 ;
  6434.       AND ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) <= 218
  6435.    m.fromvpos = vpos
  6436.    m.fromhpos = hpos
  6437.    m.joinid = uniqueid
  6438.    m.joinrec = RECNO()
  6439.  
  6440.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.joinid
  6441.    IF FOUND()
  6442.       m.tovpos = vpos
  6443.       m.tohpos = hpos
  6444.  
  6445.       SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND (WIDTH = 1 OR height = 1)
  6446.          IF WIDTH = 1 AND hpos = m.fromhpos
  6447.             DO CASE
  6448.             CASE vpos = m.fromvpos + 1
  6449.                DO addjoin WITH vpos, hpos, m.tovpos, m.tohpos, 2, 2
  6450.  
  6451.             CASE vpos+HEIGHT = m.fromvpos
  6452.                DO addjoin WITH vpos+HEIGHT-1, hpos, m.tovpos, m.tohpos, 2, 2
  6453.             ENDCASE
  6454.          ENDIF
  6455.  
  6456.          IF height = 1 AND vpos = m.fromvpos
  6457.             DO CASE
  6458.             CASE hpos = m.fromhpos + 1
  6459.                DO addjoin WITH vpos, hpos, m.tovpos, m.tohpos, 2, 2
  6460.  
  6461.             CASE hpos+WIDTH = m.fromhpos
  6462.                DO addjoin WITH vpos, hpos+WIDTH-1, m.tovpos, m.tohpos, 2, 2
  6463.             ENDCASE
  6464.          ENDIF
  6465.       ENDSCAN
  6466.    ENDIF
  6467.  
  6468.    GOTO RECORD m.joinrec
  6469. ENDSCAN
  6470.  
  6471. IF m.saverec > RECCOUNT()
  6472.    LOCATE FOR .F.
  6473. ELSE
  6474.    GOTO RECORD m.saverec
  6475. ENDIF
  6476. RETURN
  6477.  
  6478. *
  6479. * zapBoxChar - This procedure looks for any text record which is probably a box join
  6480. *            character and replaces it with a transparent space.
  6481. *
  6482. *!*****************************************************************************
  6483. *!
  6484. *!      Procedure: ZAPBOXCHAR
  6485. *!
  6486. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6487. *!
  6488. *!*****************************************************************************
  6489. PROCEDURE zapboxchar
  6490. PRIVATE m.recno, m.fromvpos, m.fromhpos
  6491. m.recno = RECNO()
  6492.  
  6493. * See if we can find any single text box/line joining characters in a group.
  6494. SCAN FOR platform = m.g_toplatform AND objtype = c_ottext ;
  6495.       AND boxjoin(objtype,recno(),platform)
  6496.    REPLACE expr WITH '" "'
  6497.    REPLACE mode WITH 1
  6498. ENDSCAN
  6499.  
  6500. IF m.recno > RECCOUNT()
  6501.    GOTO RECCOUNT()
  6502.    SKIP
  6503. ELSE
  6504.    GOTO RECORD m.recno
  6505. ENDIF
  6506. RETURN
  6507.  
  6508. *
  6509. * AddJoin - This routine adds the position for a join character, or modifies a previous join
  6510. *      at the same from position if it has a lower priority.
  6511. *
  6512. *!*****************************************************************************
  6513. *!
  6514. *!      Procedure: ADDJOIN
  6515. *!
  6516. *!      Called by: JOINHORIZONTAL     (procedure in TRANSPRT.PRG)
  6517. *!               : JOINVERTICAL       (procedure in TRANSPRT.PRG)
  6518. *!               : MEETBOXCHAR        (procedure in TRANSPRT.PRG)
  6519. *!
  6520. *!*****************************************************************************
  6521. PROCEDURE addjoin
  6522. PARAMETER m.fromvpos, m.fromhpos, m.tovpos, m.tohpos, m.vmatch, m.hmatch
  6523. PRIVATE m.row, m.key
  6524. m.key = STR(m.fromvpos, 3)+STR(m.fromhpos, 3)
  6525. m.row = ASCAN(joins, m.key)
  6526. IF m.row = 0
  6527.    m.joincount = m.joincount + 1
  6528.    DIMENSION joins[m.joinCount, 5]
  6529.    joins[m.joinCount, 1] = m.key
  6530.    joins[m.joinCount, 2] = m.tovpos
  6531.    joins[m.JoinCount, 3] = m.tohpos
  6532.    joins[m.JoinCount, 4] = m.vmatch
  6533.    joins[m.JoinCount, 5] = m.hmatch
  6534. ELSE
  6535.    m.row = ASUBSCRIPT(joins, m.row, 1)
  6536.  
  6537.    IF m.vmatch > joins[m.row, 4]
  6538.       joins[m.row, 2] = m.tovpos
  6539.       joins[m.row, 4] = m.vmatch
  6540.    ENDIF
  6541.  
  6542.    IF m.hmatch > joins[m.JoinCount, 5]
  6543.       joins[m.row, 3] = m.tohpos
  6544.       joins[m.row, 5] = m.hmatch
  6545.    ENDIF
  6546. ENDIF
  6547.  
  6548. RETURN
  6549.  
  6550. *
  6551. * RejoinBoxes - This routine stretches lines so that they meet the join characters
  6552. *      they did in the from platform.
  6553. *
  6554. *!*****************************************************************************
  6555. *!
  6556. *!      Procedure: REJOINBOXES
  6557. *!
  6558. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6559. *!
  6560. *!          Calls: JOINLINEWIDTH()    (function  in TRANSPRT.PRG)
  6561. *!               : GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6562. *!
  6563. *!*****************************************************************************
  6564. PROCEDURE rejoinboxes
  6565. PARAMETER m.fromvpos, m.fromhpos, m.tovpos, m.tohpos
  6566. PRIVATE m.objectcode, m.objend, m.saverecno, m.objid, m.joinwidth, m.objrec
  6567.  
  6568. m.saverecno = RECNO()
  6569.  
  6570. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox
  6571.    IF WIDTH = 1 OR height = 1
  6572.       m.objid = uniqueid
  6573.       m.objectcode = objcode
  6574.       m.objrec = RECNO()
  6575.  
  6576.       DO CASE
  6577.          ** A Vertical line which starts at a join character
  6578.       CASE m.fromvpos = vpos AND m.fromhpos = hpos AND WIDTH = 1
  6579.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6580.          IF FOUND()
  6581.             m.objend = vpos + HEIGHT
  6582.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .T., m.objid)
  6583.             REPLACE vpos WITH m.tovpos + c_adjbox - (m.joinwidth/2)
  6584.             REPLACE height WITH m.objend - vpos
  6585.             REPLACE hpos WITH m.tohpos + c_adjbox - (getlinewidth(m.objectcode, .F.)/2)
  6586.          ENDIF
  6587.  
  6588.          ** A Horizontal line which starts at a join character
  6589.       CASE m.fromvpos = vpos AND m.fromhpos = hpos AND height = 1
  6590.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6591.          IF FOUND()
  6592.             m.objend = hpos + WIDTH
  6593.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .F., m.objid)
  6594.             REPLACE hpos WITH m.tohpos + c_adjbox - (m.joinwidth/2)
  6595.             REPLACE WIDTH WITH m.objend - hpos
  6596.             REPLACE vpos WITH m.tovpos + c_adjbox - (getlinewidth(m.objectcode, .T.)/2)
  6597.          ENDIF
  6598.  
  6599.          ** A Vertical line which ends at a join character
  6600.       CASE m.fromvpos = (vpos+HEIGHT-1) AND m.fromhpos = hpos AND WIDTH = 1
  6601.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6602.          IF FOUND()
  6603.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .T., m.objid)
  6604.             REPLACE height WITH (m.tovpos + c_adjbox + (m.joinwidth/2)) - vpos
  6605.             REPLACE hpos WITH m.tohpos + c_adjbox - (getlinewidth(m.objectcode, .F.)/2)
  6606.          ENDIF
  6607.  
  6608.          ** A Horizontal line which ends at a join character
  6609.       CASE m.fromhpos = (hpos+WIDTH-1) AND m.fromvpos = vpos AND height = 1
  6610.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6611.          IF FOUND()
  6612.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .F., m.objid)
  6613.             REPLACE WIDTH WITH (m.tohpos + c_adjbox + (m.joinwidth/2)) - hpos
  6614.             REPLACE vpos WITH m.tovpos + c_adjbox - (getlinewidth(m.objectcode, .T.)/2)
  6615.          ENDIF
  6616.       ENDCASE
  6617.  
  6618.       GOTO RECORD m.objrec
  6619.    ENDIF
  6620. ENDSCAN
  6621.  
  6622. IF m.saverecno > RECCOUNT()
  6623.    LOCATE FOR .F.
  6624. ELSE
  6625.    GOTO RECORD m.saverecno
  6626. ENDIF
  6627.  
  6628. RETURN
  6629.  
  6630. *
  6631. * JoinLineWidth - Looks for the thickest line or box which goes through a given point and
  6632. *      Returns either its horizontal or vertical Width.
  6633. *
  6634. *!*****************************************************************************
  6635. *!
  6636. *!       Function: JOINLINEWIDTH
  6637. *!
  6638. *!      Called by: REJOINBOXES        (procedure in TRANSPRT.PRG)
  6639. *!
  6640. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6641. *!
  6642. *!*****************************************************************************
  6643. FUNCTION joinlinewidth
  6644. PARAMETERS m.joinvpos, m.joinhpos, m.horizontal, m.skipid
  6645. PRIVATE m.i, m.saverecno, m.thickness
  6646. m.saverecno = RECNO()
  6647. m.thickness = 0
  6648.  
  6649. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND uniqueid <> m.skipid
  6650.    DO CASE
  6651.    CASE m.horizontal AND WIDTH <> 1 AND ;
  6652.          (ABS(m.joinvpos - vpos) <= 1 OR ABS(m.joinvpos - (vpos+HEIGHT-1)) <= 1) AND ;
  6653.          (m.joinhpos >= hpos AND m.joinhpos <= (hpos+WIDTH-1))
  6654.       m.thickness = MAX(getlinewidth(objcode, .T.), m.thickness)
  6655.  
  6656.    CASE !m.horizontal AND HEIGHT <> 1 AND ;
  6657.          (ABS(m.joinhpos - hpos) <= 1 OR ABS(m.joinhpos - (hpos+WIDTH-1)) <= 1) AND ;
  6658.          (m.joinvpos >= vpos AND m.joinvpos <= (vpos+WIDTH-1))
  6659.       m.thickness = MAX(getlinewidth(objcode, .F.), m.thickness)
  6660.    ENDCASE
  6661. ENDSCAN
  6662.  
  6663. IF m.thickness = 0
  6664.    SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND uniqueid <> m.skipid
  6665.       IF (HEIGHT = 1 OR WIDTH = 1) AND ;
  6666.             (ABS(m.joinvpos - vpos) <= 1 OR ABS(m.joinvpos - (vpos+HEIGHT-1)) <= 1) AND ;
  6667.             (ABS(m.joinhpos - hpos) <= 1 OR ABS(m.joinhpos - (hpos+WIDTH-1)) <= 1)
  6668.          m.thickness = MAX(getlinewidth(objcode, m.horizontal), m.thickness)
  6669.       ENDIF
  6670.    ENDSCAN
  6671. ENDIF
  6672.  
  6673. GOTO RECORD m.saverecno
  6674. RETURN m.thickness
  6675.  
  6676. *
  6677. * getLastObjectLine - Determine if this object is the lowest object.
  6678. *
  6679. *!*****************************************************************************
  6680. *!
  6681. *!       Function: GETLASTOBJECTLINE
  6682. *!
  6683. *!      Called by: REPOOBJECTS        (procedure in TRANSPRT.PRG)
  6684. *!
  6685. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  6686. *!
  6687. *!*****************************************************************************
  6688. FUNCTION getlastobjectline
  6689. PARAMETER m.currentlastline, m.newposition
  6690. PRIVATE m.numitems, m.max
  6691.  
  6692. DO CASE
  6693. CASE objtype = c_ottext OR objtype = c_otchkbox
  6694.    IF vpos > m.currentlastline
  6695.       g_lastobjectline[2] = m.newposition + HEIGHT
  6696.       RETURN vpos + HEIGHT
  6697.    ELSE
  6698.       RETURN m.currentlastline
  6699.    ENDIF
  6700.  
  6701. CASE objtype = c_otradbut OR objtype = c_ottxtbut OR objtype = c_otinvbut
  6702.    IF horizbutton(PICTURE)
  6703.       IF vpos + HEIGHT >= m.currentlastline
  6704.          g_lastobjectline[2] = m.newposition + HEIGHT
  6705.          RETURN vpos
  6706.       ELSE
  6707.          RETURN m.currentlastline
  6708.       ENDIF
  6709.    ELSE
  6710.       m.numitems = OCCURS(';',PICTURE)
  6711.       m.max = vpos + m.numitems + (m.numitems * spacing)
  6712.       IF m.max >= m.currentlastline AND (objtype = c_ottxtbut OR objtype = c_otinvbut) OR ;
  6713.             m.max > m.currentlastline AND objtype = c_otradbut
  6714.          g_lastobjectline[2] = m.newposition + (HEIGHT * (m.numitems + 1)) + ;
  6715.             (spacing * m.numitems)
  6716.          RETURN m.max + 1
  6717.       ELSE
  6718.          RETURN m.currentlastline
  6719.       ENDIF
  6720.    ENDIF
  6721.  
  6722. CASE objtype = c_otpopup
  6723.    IF vpos + 2 > m.currentlastline
  6724.       g_lastobjectline[2] = m.newposition + 2
  6725.       RETURN vpos +1
  6726.    ELSE
  6727.       RETURN m.currentlastline
  6728.    ENDIF
  6729.  
  6730. CASE objtype = c_otfield
  6731.    IF vpos + HEIGHT -1 > m.currentlastline
  6732.       g_lastobjectline[2] = m.newposition + HEIGHT
  6733.       RETURN vpos + HEIGHT -1
  6734.    ELSE
  6735.       RETURN m.currentlastline
  6736.    ENDIF
  6737.  
  6738. CASE objtype = c_otlist OR ;
  6739.       objtype = c_otbox OR objtype = c_otline
  6740.    IF vpos + HEIGHT - 1 > m.currentlastline
  6741.       g_lastobjectline[2] = m.newposition + HEIGHT
  6742.       RETURN vpos + HEIGHT - 1
  6743.    ELSE
  6744.       RETURN m.currentlastline
  6745.    ENDIF
  6746.  
  6747. OTHERWISE
  6748.    RETURN m.currentlastline
  6749.  
  6750. ENDCASE
  6751.  
  6752. *
  6753. * adjobjcode - Adjust object code field for Objtype = 1.
  6754. *
  6755. *!*****************************************************************************
  6756. *!
  6757. *!      Procedure: ADJOBJCODE
  6758. *!
  6759. *!      Called by: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  6760. *!
  6761. *!*****************************************************************************
  6762. PROCEDURE adjobjcode
  6763. * Stuff the right version code into the object code field for the header record
  6764. DO CASE
  6765. CASE objtype = c_otheader OR (m.g_filetype=c_label AND objtype = c_ot20label)
  6766.    REPLACE objcode WITH IIF(m.g_filetype=c_screen,c_25scx,c_25frx)
  6767. CASE objtype = c_otgroup
  6768.    REPLACE objcode WITH 0
  6769. ENDCASE
  6770.  
  6771. *!*****************************************************************************
  6772. *!
  6773. *!      Procedure: GETWINDFONT
  6774. *!
  6775. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  6776. *!
  6777. *!          Calls: num2style()        (function  in TRANSPRT.PRG)
  6778. *!
  6779. *!*****************************************************************************
  6780. PROCEDURE getwindfont
  6781. * Get the default font for this window, if one has been defined
  6782. IF m.g_char2grph
  6783.    * Get font information from header
  6784.    GOTO TOP
  6785.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6786.    IF FOUND() AND !EMPTY(fontface)
  6787.       m.g_dfltfface  = fontface
  6788.       m.g_dfltfsize  = fontsize
  6789.       m.g_dfltfstyle = num2style(fontstyle)
  6790.    ENDIF
  6791. ENDIF
  6792. RETURN
  6793.  
  6794. *
  6795. * adjHeightAndWidth - Adjust the Height and width of objects.
  6796. *
  6797. *!*****************************************************************************
  6798. *!
  6799. *!      Procedure: ADJHEIGHTANDWIDTH
  6800. *!
  6801. *!      Called by: NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  6802. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  6803. *!
  6804. *!          Calls: num2style()        (function  in TRANSPRT.PRG)
  6805. *!               : DOSSIZE()          (function  in TRANSPRT.PRG)
  6806. *!               : COLUMNAR()         (function  in TRANSPRT.PRG)
  6807. *!               : ADJTEXT            (procedure in TRANSPRT.PRG)
  6808. *!               : ADJBITMAPCTRL      (procedure in TRANSPRT.PRG)
  6809. *!               : MAXBTNWIDTH()      (function  in TRANSPRT.PRG)
  6810. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  6811. *!
  6812. *!*****************************************************************************
  6813. PROCEDURE adjheightandwidth
  6814. PRIVATE m.txtwidthratio, m.boldtxtratio, m.chkboxwidth, m.saverec, ;
  6815.    m.oldwidth, m.newheight, m.newwidth, ;
  6816.    m.wndface, m.wndsize, m.wndstyle, m.alignment
  6817. * Only Screen objects come through this routine.
  6818.  
  6819. DO CASE
  6820. CASE m.g_char2grph
  6821.    m.saverec = RECNO()
  6822.    * Get font information from header
  6823.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6824.    IF FOUND()
  6825.       m.wndface  = fontface
  6826.       m.wndsize  = fontsize
  6827.       m.wndstyle = fontstyle
  6828.    ELSE
  6829.       m.wndface  = m.g_dfltfface
  6830.       m.wndsize  = m.g_dfltfsize
  6831.       m.wndstyle = m.g_dfltfstyle
  6832.    ENDIF
  6833.    GOTO m.saverec
  6834.  
  6835.    * This is the ratio of character size for the window font to that for the current object font
  6836.    m.txtwidthratio = FONTMETRIC(6, m.wndface, m.wndsize, num2style(m.wndstyle)) / ;
  6837.       FONTMETRIC(6,fontface,fontsize,num2style(fontstyle))
  6838.    m.boldtxtratio = FONTMETRIC(6, m.wndface, m.wndsize, num2style(m.wndstyle)) / ;
  6839.       FONTMETRIC(6,m.g_dfltfface,m.g_dfltfsize,num2style(m.g_boldstylenum))
  6840.    m.chkboxwidth = c_chkpixel / FONTMETRIC(6,m.g_dfltfface,m.g_dfltfsize,num2style(m.g_boldstylenum))
  6841.    m.chkboxwidth = m.chkboxwidth + (m.chkboxwidth / 2)
  6842. CASE m.g_grph2char
  6843.    m.saverec = RECNO()
  6844.    LOCATE FOR platform = m.g_fromplatform AND objtype = c_otheader
  6845.    IF FOUND()
  6846.       m.wndface = fontface
  6847.       m.wndsize = fontsize
  6848.       m.wndstyle = fontstyle
  6849.    ELSE
  6850.       m.wndface  = m.g_ctrlfface    && MS Sans Serif for Windows
  6851.       m.wndsize  = m.g_ctrlfsize
  6852.       m.wndstyle = m.g_ctrlfstyle
  6853.    ENDIF
  6854.    GOTO m.saverec
  6855. ENDCASE
  6856.  
  6857. DO CASE
  6858. CASE objtype = c_ottext
  6859.    DO CASE
  6860.    CASE m.g_char2grph
  6861.       m.oldwidth = WIDTH
  6862.       REPLACE WIDTH WITH TXTWIDTH(SUBSTR(expr, 2,LEN(expr)-2), fontface, ;
  6863.          fontsize, num2style(fontstyle)) && * m.txtwidthratio
  6864.    CASE m.g_grph2char
  6865.       m.oldwidth = ROUND(dossize(WIDTH, fontsize, m.wndsize), 0)
  6866.       m.newheight = 1
  6867.       m.newwidth = LEN(expr)-2
  6868.  
  6869.       m.alignment = columnar(vpos, hpos, WIDTH, objtype)
  6870.       DO CASE
  6871.       CASE m.alignment = 2
  6872.          REPLACE hpos WITH hpos + WIDTH - m.newwidth
  6873.  
  6874.       CASE m.alignment = 0
  6875.          REPLACE vpos WITH vpos + ((HEIGHT - m.newheight) / 2)
  6876.          REPLACE hpos WITH hpos + ((WIDTH - m.newwidth) / 2)
  6877.       ENDCASE
  6878.  
  6879.       REPLACE height WITH MAX(m.newheight,1)
  6880.       REPLACE WIDTH WITH MAX(m.newwidth,1)
  6881.  
  6882.       DO adjtext WITH m.oldwidth
  6883.    ENDCASE
  6884.  
  6885. CASE objtype = c_otchkbox
  6886.    DO CASE
  6887.    CASE m.g_char2grph
  6888.       m.oldwidth = WIDTH
  6889.       REPLACE WIDTH WITH (TXTWIDTH(SUBSTR(PICTURE, 6,LEN(PICTURE)-6) + SPACE(1), fontface, ;
  6890.          fontsize, num2style(fontstyle)) * m.boldtxtratio) + m.chkboxwidth
  6891.       REPLACE height WITH c_chkhght
  6892.    CASE m.g_grph2char
  6893.       DO adjbitmapctrl
  6894.  
  6895.       REPLACE height WITH 1
  6896.       REPLACE WIDTH WITH maxbtnwidth(PICTURE, "", "", "")+4
  6897.    ENDCASE
  6898.  
  6899. CASE objtype = c_otradbut
  6900.    DO CASE
  6901.    CASE m.g_char2grph
  6902.       m.oldwidth = WIDTH
  6903.       DO adjbitmapctrl
  6904.       REPLACE height WITH c_radhght
  6905.    CASE m.g_grph2char
  6906.       REPLACE height WITH 1
  6907.       REPLACE spacing WITH ROUND(dossize(spacing, fontsize, m.wndsize), 0)
  6908.       REPLACE WIDTH WITH MAX(maxbtnwidth(PICTURE, "", "", "")+4, dossize(WIDTH, fontsize, m.wndsize))
  6909.    ENDCASE
  6910.  
  6911. CASE objtype = c_otpopup
  6912.    DO CASE
  6913.    CASE m.g_char2grph
  6914.       * Force all popups to default height
  6915.       REPLACE height WITH m.g_pophght
  6916.    CASE m.g_grph2char
  6917.       m.newheight = 3
  6918.       REPLACE vpos WITH MAX(vpos + ((HEIGHT - m.newheight) / 2),0)
  6919.       REPLACE height WITH m.newheight
  6920.       REPLACE WIDTH WITH dossize(WIDTH, fontsize, m.wndsize)
  6921.    CASE m.g_grph2grph
  6922.       * Force all popups to default height
  6923.       REPLACE height WITH m.g_pophght
  6924.    ENDCASE
  6925.  
  6926. CASE objtype = c_ottxtbut
  6927.    DO CASE
  6928.    CASE m.g_char2grph
  6929.        * Force all push buttons to default height when coming from DOS
  6930.       REPLACE height WITH m.g_btnheight
  6931.    CASE m.g_grph2char
  6932.       DO adjbitmapctrl
  6933.  
  6934.       REPLACE height WITH 1
  6935.       REPLACE spacing WITH ROUND(dossize(spacing, fontsize, m.wndsize), 0)
  6936.       REPLACE WIDTH WITH MAX(maxbtnwidth(PICTURE, "", "", "")+2, dossize(WIDTH, fontsize, m.wndsize))
  6937.     CASE m.g_grph2grph
  6938.         * This case is handled in fillininfo
  6939.    ENDCASE
  6940.  
  6941. CASE objtype = c_otfield
  6942.    DO CASE
  6943.    CASE m.g_char2grph
  6944.       REPLACE height WITH height + c_adjfld
  6945.    CASE m.g_grph2char
  6946.       IF INLIST(objcode,c_sgsay, c_sgget)
  6947.          REPLACE height WITH 1
  6948.       ELSE
  6949.          REPLACE height WITH MAX(dossize(HEIGHT, fontsize, m.wndsize),1)
  6950.       ENDIF
  6951.       REPLACE WIDTH WITH MAX(dossize(WIDTH, fontsize, m.wndsize),1)
  6952.    ENDCASE
  6953.  
  6954. CASE objtype = c_otline OR objtype = c_otbox
  6955.    IF m.g_grph2char
  6956.       DO adjbox WITH 0
  6957.    ENDIF
  6958. ENDCASE
  6959.  
  6960. IF m.g_grph2char OR m.g_char2grph AND INLIST(objtype,C_OBJTYPELIST)
  6961.       REPLACE hpos WITH MAX(hpos,0)
  6962.     REPLACE vpos WITH MAX(vpos,0)
  6963. ENDIF
  6964.  
  6965. RETURN
  6966.  
  6967. *
  6968. * Columnar - This function takes and object and checks to see if it
  6969. *      is right or left aligned with other objects in a column.
  6970. *      Return values are:
  6971. *         0 - Not aligned
  6972. *         1 - Left aligned
  6973. *         2 - Right aligned
  6974. *
  6975. *!*****************************************************************************
  6976. *!
  6977. *!       Function: COLUMNAR
  6978. *!
  6979. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  6980. *!
  6981. *!*****************************************************************************
  6982. FUNCTION columnar
  6983. PARAMETER m.vpos, m.hpos, m.type, m.otype
  6984. PRIVATE m.saverec
  6985.  
  6986. m.saverec = RECNO()
  6987.  
  6988. LOCATE FOR platform = m.g_fromplatform AND objtype = m.type AND ;
  6989.    hpos = m.hpos AND ABS(vpos - m.vpos) < m.vpos * 2
  6990. IF FOUND()
  6991.    GOTO RECORD (m.saverec)
  6992.    RETURN 1
  6993. ENDIF
  6994.  
  6995. LOCATE FOR platform = m.g_fromplatform AND objtype = m.type AND ;
  6996.    hpos + WIDTH = m.hpos + m.width  AND ;
  6997.    ABS(vpos - m.vpos) < m.vpos * 2
  6998. IF FOUND()
  6999.    GOTO RECORD (m.saverec)
  7000.    RETURN 2
  7001. ENDIF
  7002.  
  7003. GOTO RECORD (m.saverec)
  7004. RETURN 0
  7005.  
  7006. *
  7007. * DOSSize - This function attempts to normalize a dimension of an object to the font used for the
  7008. *      window it lies in.  Unfortunately, we can't use FONTMETRIC since this needs to run on a character
  7009. *      platform.  We use the ratio of point sizes.
  7010. *
  7011. *!*****************************************************************************
  7012. *!
  7013. *!       Function: DOSSIZE
  7014. *!
  7015. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7016. *!
  7017. *!*****************************************************************************
  7018. FUNCTION dossize
  7019. PARAMETER m.size, m.objsize, m.scrnsize
  7020. RETURN m.size * (m.objsize / m.scrnsize)
  7021.  
  7022. *
  7023. * AdjBitmapCtrl - Take the Picture clause for a control, see if it is a bitmap and
  7024. *      turn it into something that a character platform can handle.
  7025. *
  7026. *!*****************************************************************************
  7027. *!
  7028. *!      Procedure: ADJBITMAPCTRL
  7029. *!
  7030. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7031. *!
  7032. *!          Calls: STRIPPATH()        (function  in TRANSPRT.PRG)
  7033. *!
  7034. *!*****************************************************************************
  7035. PROCEDURE adjbitmapctrl
  7036. PRIVATE m.function, m.oldpicture, m.newpicture, m.temp
  7037.  
  7038. m.function = ALLTRIM(SUBSTR(PICTURE, 1, AT(" ", PICTURE)))
  7039.  
  7040. IF AT("B", m.function) <> 0
  7041.    m.function = CHRTRANC(m.function, "B", "")
  7042.    m.oldpicture = ALLTRIM(SUBSTR(PICTURE, AT(" ", PICTURE)))
  7043.    m.newpicture = ""
  7044.  
  7045.    DO WHILE LEN(m.oldpicture) > 0
  7046.       IF AT(";", m.oldpicture) = 0
  7047.          m.temp = LEFT(m.oldpicture, LEN(m.oldpicture)-1)
  7048.          m.oldpicture = ""
  7049.       ELSE
  7050.          m.temp = LEFT(m.oldpicture, AT(";", m.oldpicture)-1)
  7051.          m.oldpicture = SUBSTR(m.oldpicture, AT(";", m.oldpicture)+1)
  7052.       ENDIF
  7053.  
  7054.       IF LEN(m.newpicture) = 0
  7055.          m.newpicture = ALLTRIM(strippath(m.temp))
  7056.       ELSE
  7057.          m.newpicture = m.newpicture + ";" + ALLTRIM(strippath(m.temp))
  7058.       ENDIF
  7059.    ENDDO
  7060.  
  7061.    REPLACE PICTURE WITH m.function + " " + m.newpicture + '"'
  7062. ENDIF
  7063.  
  7064. RETURN
  7065. *
  7066. * AdjColor - Adjust color fields in the database.
  7067. *
  7068. *!*****************************************************************************
  7069. *!
  7070. *!      Procedure: ADJCOLOR
  7071. *!
  7072. *!      Called by: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  7073. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  7074. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7075. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  7076. *!
  7077. *!          Calls: CONVERTCOLORPAIR   (procedure in TRANSPRT.PRG)
  7078. *!               : RGBTOX()           (function  in TRANSPRT.PRG)
  7079. *!
  7080. *!*****************************************************************************
  7081. PROCEDURE adjcolor
  7082. DO CASE
  7083. CASE m.g_char2grph
  7084.    IF m.g_filetype = c_report OR m.g_filetype = c_label OR EMPTY(colorpair)
  7085.       IF m.g_filetype = c_screen
  7086.          REPLACE colorpair WITH ""
  7087.          REPLACE penred    WITH -1
  7088.          REPLACE pengreen  WITH -1
  7089.          REPLACE penblue   WITH -1
  7090.          REPLACE fillred   WITH -1
  7091.          REPLACE fillgreen WITH -1
  7092.          REPLACE fillblue  WITH -1
  7093.       ELSE
  7094.          REPLACE penred    WITH 0
  7095.          REPLACE pengreen  WITH 0
  7096.          REPLACE penblue   WITH 0
  7097.          IF objtype = c_otline
  7098.             REPLACE fillred   WITH 0
  7099.             REPLACE fillgreen WITH 0
  7100.             REPLACE fillblue  WITH 0
  7101.          ELSE
  7102.             REPLACE fillred   WITH 255
  7103.             REPLACE fillgreen WITH 255
  7104.             REPLACE fillblue  WITH 255
  7105.          ENDIF
  7106.       ENDIF
  7107.    ELSE
  7108.       DO convertcolorpair
  7109.    ENDIF
  7110. CASE m.g_grph2char
  7111.    IF m.g_filetype = c_screen
  7112.       DO CASE
  7113.       CASE objtype = c_otheader
  7114.          DO CASE
  7115.          CASE STYLE = c_user
  7116.             IF SCHEME + scheme2 = 0
  7117.                REPLACE SCHEME WITH 1
  7118.                REPLACE scheme2 WITH 2
  7119.             ENDIF
  7120.  
  7121.          CASE STYLE = c_system
  7122.             REPLACE SCHEME WITH 8
  7123.             REPLACE scheme2 WITH 9
  7124.  
  7125.          CASE STYLE = c_dialog
  7126.             REPLACE SCHEME WITH 5
  7127.             REPLACE scheme2 WITH 6
  7128.  
  7129.          CASE STYLE = c_alert
  7130.             REPLACE SCHEME WITH 7
  7131.             REPLACE SCHEME WITH 12
  7132.          ENDCASE
  7133.  
  7134.       CASE c_maptextcolor AND INLIST(objtype,c_otbox, c_otline,c_ottext)
  7135.          IF penred <> -1 OR fillred <> -1
  7136.             REPLACE colorpair WITH rgbtox(penred, penblue, pengreen) + "/" + ;
  7137.                rgbtox(fillred, fillblue, fillgreen)
  7138.             * Don't let it map to black on black
  7139.             IF colorpair = "N/N" OR TRIM(colorpair) == "/"
  7140.                REPLACE colorpair WITH ""
  7141.             ENDIF
  7142.          ENDIF
  7143.       OTHERWISE
  7144.           REPLACE scheme WITH 0   && default color scheme for everything else
  7145.       ENDCASE
  7146.    ENDIF
  7147. ENDCASE
  7148. RETURN
  7149.  
  7150. *
  7151. * RGBToX - Convert an RGB triplet to a traditional xBase color letter
  7152. *
  7153. *!*****************************************************************************
  7154. *!
  7155. *!       Function: RGBTOX
  7156. *!
  7157. *!      Called by: ADJCOLOR           (procedure in TRANSPRT.PRG)
  7158. *!
  7159. *!*****************************************************************************
  7160. FUNCTION rgbtox
  7161. PARAMETERS m.red, m.blue, m.green
  7162. PRIVATE m.color
  7163.  
  7164. *
  7165. * If it is automatic, we skip it.
  7166. *
  7167. IF m.red < 0 OR m.blue < 0 OR m.green < 0
  7168.    RETURN ""
  7169. ENDIF
  7170.  
  7171. *
  7172. * We use a special triplet for Light Gray which makes it a special case.
  7173. *
  7174. IF m.red = 192 AND m.blue = 192 AND m.green = 192
  7175.    RETURN "W"
  7176. ENDIF
  7177. IF _MAC AND m.red = 192 AND m.blue = 192 AND m.green = 192
  7178.    RETURN "W"
  7179. ENDIF
  7180.  
  7181. *
  7182. * This division makes sure that we give a letter for any possible triplet
  7183. *
  7184. m.red   = ROUND(m.red / 127, 0)
  7185. m.blue = ROUND(m.blue / 127, 0)
  7186. m.green = ROUND(m.green / 127, 0)
  7187.  
  7188. *
  7189. * Save some time by getting a number we can make a single comparison against
  7190. *
  7191. m.color = (m.red * 100) + (m.blue * 10) + m.green
  7192.  
  7193. DO CASE
  7194. CASE m.color = 222      && White
  7195.    RETURN "W+"
  7196. CASE m.color = 0        && Black
  7197.    RETURN "N"
  7198. CASE m.color = 111      && Dark Gray
  7199.    RETURN "N+"
  7200. CASE m.color = 200      && Light Red
  7201.    RETURN "R+"
  7202. CASE m.color = 100      && Dark Red
  7203.    RETURN "R"
  7204. CASE m.color = 220      && Yellow
  7205.    RETURN "GR+"
  7206. CASE m.color = 110      && Brown
  7207.    RETURN "GR"
  7208. CASE m.color = 2        && Light green
  7209.    RETURN "G+"
  7210. CASE m.color = 1        && Dark Green
  7211.    RETURN "G"
  7212. CASE m.color = 22       && Light Magenta
  7213.    RETURN "BG+"
  7214. CASE m.color = 11       && Dark Magenta
  7215.    RETURN "BG"
  7216. CASE m.color = 20       && Light Blue
  7217.    RETURN "B+"
  7218. CASE m.color = 10       && Dark Blue
  7219.    RETURN "B"
  7220. CASE m.color = 202      && Light Purple
  7221.    RETURN "RB+"
  7222. CASE m.color = 101      && Dark Purple
  7223.    RETURN "RB"
  7224. ENDCASE
  7225.  
  7226. RETURN ""      && It shouldn't be possible to reach this point.
  7227.  
  7228. *
  7229. * \ - Adjust pen attributes.
  7230. *
  7231. *!*****************************************************************************
  7232. *!
  7233. *!      Procedure: ADJPEN
  7234. *!
  7235. *!      Called by: FILLININFO         (procedure in TRANSPRT.PRG)
  7236. *!
  7237. *!*****************************************************************************
  7238. PROCEDURE adjpen
  7239. IF m.g_char2grph
  7240.    DO CASE
  7241.    CASE objtype = c_ottext
  7242.       REPLACE pensize WITH 1
  7243.       REPLACE penpat  WITH 0
  7244.       REPLACE fillpat WITH 0
  7245.  
  7246.    OTHERWISE
  7247.       REPLACE pensize WITH 0
  7248.       REPLACE penpat  WITH 0
  7249.       REPLACE fillpat WITH 0
  7250.    ENDCASE
  7251. ENDIF
  7252. RETURN
  7253. *
  7254. * adjfont - Adjust font fields in the SCX or FRX database.
  7255. *
  7256. *!*****************************************************************************
  7257. *!
  7258. *!      Procedure: ADJFONT
  7259. *!
  7260. *!      Called by: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  7261. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  7262. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7263. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  7264. *!
  7265. *!*****************************************************************************
  7266. PROCEDURE adjfont
  7267. PRIVATE m.i, m.outface, m.outsize, m.outstyle
  7268. m.outface  = fontface
  7269. m.outsize  = fontsize
  7270. m.outstyle = num2style(fontstyle)
  7271. DO CASE
  7272. CASE m.g_char2grph OR m.g_grph2grph
  7273.    DO CASE
  7274.    CASE objtype = c_otheader
  7275.         DO CASE
  7276.         CASE m.g_fontset
  7277.             * User chose a font with the "font" push button.  Use it for the
  7278.             * measurement font regardless of what used to be there.
  7279.             REPLACE fontface  WITH m.g_dfltfface
  7280.              REPLACE fontsize  WITH m.g_dfltfsize
  7281.              REPLACE fontstyle WITH style2num(m.g_dfltfstyle)
  7282.         CASE commonfont(fontface)
  7283.             * Original measurement font was Arial, Courier, etc.  Leave it
  7284.             * alone.
  7285.         OTHERWISE
  7286.             * Use the defaults
  7287.             REPLACE fontface  WITH m.g_windfface
  7288.              REPLACE fontsize  WITH m.g_windfsize
  7289.              REPLACE fontstyle WITH style2num(m.g_windfstyle)
  7290.         ENDCASE
  7291.  
  7292.    CASE INLIST(objtype,c_ottxtbut,c_otradbut,c_otchkbox,c_otinvbut,c_otspinner)
  7293.         IF !commonfont(fontface)
  7294.           REPLACE fontface  WITH m.g_ctrlfface
  7295.           REPLACE fontsize  WITH m.g_ctrlfsize
  7296.           REPLACE fontstyle WITH style2num(m.g_ctrlfstyle)
  7297.         ENDIF
  7298.  
  7299.    CASE INLIST(objtype, c_otbox, c_otline)
  7300.         IF !commonfont(fontface)
  7301.              REPLACE fontface  WITH m.g_ctrlfface
  7302.              REPLACE fontsize  WITH m.g_ctrlfsize
  7303.             IF objtype = c_otbox AND m.g_filetype = c_screen AND style <> 0
  7304.                 * Special case of rounded rectangles
  7305.                 REPLACE fontstyle WITH 0
  7306.             ELSE
  7307.                  REPLACE fontstyle WITH style2num(m.g_ctrlfstyle)
  7308.             ENDIF
  7309.         ENDIF
  7310.  
  7311.    CASE objtype = c_otpopup
  7312.         IF !commonfont(fontface)
  7313.           REPLACE fontface  WITH m.g_ctrlfface
  7314.           REPLACE fontsize  WITH m.g_ctrlfsize
  7315.           REPLACE fontstyle WITH m.g_normstylenum
  7316.       ENDIF
  7317.  
  7318.    CASE objtype = c_ottext
  7319.       DO CASE
  7320.         CASE m.g_char2grph OR (m.g_grph2grph AND m.g_fontset)
  7321.          REPLACE fontface  WITH m.g_dfltfface
  7322.          REPLACE fontsize  WITH m.g_dfltfsize
  7323.          REPLACE fontstyle WITH m.g_boldstylenum
  7324.         CASE !commonfont(fontface)
  7325.             DO mapfont WITH fontface, fontsize, num2style(fontstyle), m.outface, m.outsize, m.outstyle, _MAC
  7326.             REPLACE fontface  WITH m.outface
  7327.             REPLACE fontsize  WITH m.outsize
  7328.             REPLACE fontstyle WITH style2num(m.outstyle)
  7329.       ENDCASE
  7330.  
  7331.    CASE objtype = c_otfield
  7332.         DO CASE
  7333.       CASE m.g_char2grph OR (m.g_grph2grph AND m.g_fontset)
  7334.          REPLACE fontface  WITH m.g_dfltfface
  7335.          REPLACE fontsize  WITH m.g_dfltfsize
  7336.          REPLACE fontstyle WITH m.g_normstylenum
  7337.       CASE !commonfont(fontface)
  7338.             DO mapfont WITH fontface, fontsize, num2style(fontstyle), m.outface, m.outsize, m.outstyle, _MAC
  7339.             REPLACE fontface  WITH m.outface
  7340.             REPLACE fontsize  WITH m.outsize
  7341.             REPLACE fontstyle WITH style2num(m.outstyle)
  7342.       ENDCASE
  7343.  
  7344.    OTHERWISE
  7345.         DO CASE
  7346.       CASE m.g_char2grph OR (m.g_grph2grph AND m.g_fontset)
  7347.          REPLACE fontface  WITH m.g_dfltfface
  7348.          REPLACE fontsize  WITH m.g_dfltfsize
  7349.          REPLACE fontstyle WITH m.g_normstylenum
  7350.       CASE !commonfont(fontface)
  7351.             DO mapfont WITH fontface, fontsize, num2style(fontstyle), m.outface, m.outsize, m.outstyle, _MAC
  7352.             REPLACE fontface  WITH m.outface
  7353.             REPLACE fontsize  WITH m.outsize
  7354.             REPLACE fontstyle WITH style2num(m.outstyle)
  7355.         ENDCASE
  7356.    ENDCASE
  7357. ENDCASE
  7358. RETURN
  7359.  
  7360. *!*****************************************************************************
  7361. *!
  7362. *!      Function: COMMONFONT
  7363. *!
  7364. *!*****************************************************************************
  7365. FUNCTION commonfont
  7366. * Is the font one that is in common for Mac and Windows?
  7367. PARAMETER m.thefont
  7368. m.thefont = UPPER(ALLTRIM(m.thefont))
  7369. RETURN INLIST(m.thefont, "ARIAL", "COURIER NEW", "TIMES NEW ROMAN")
  7370.  
  7371. *
  7372. * convertColorPair - Convert the color pair to appropriate RGB pen
  7373. *               and fill values.
  7374. *
  7375. *!*****************************************************************************
  7376. *!
  7377. *!      Procedure: CONVERTCOLORPAIR
  7378. *!
  7379. *!      Called by: ADJCOLOR           (procedure in TRANSPRT.PRG)
  7380. *!
  7381. *!          Calls: GETCOLOR()         (function  in TRANSPRT.PRG)
  7382. *!
  7383. *!*****************************************************************************
  7384. PROCEDURE convertcolorpair
  7385. PRIVATE m.oldscheme, m.rgbvalue, m.comma, m.frg, m.bkg
  7386.  
  7387. * Translate foreground colors
  7388. m.frg = UPPER(CHRTRANC(LEFT(colorpair,AT('/',colorpair)-1),'-*/, ',''))
  7389. REPLACE penred    WITH -1
  7390. REPLACE pengreen  WITH -1
  7391. REPLACE penblue   WITH -1
  7392. IF "W" $ m.frg
  7393.    REPLACE penred    WITH IIF('+' $ m.frg,255,128)
  7394.    REPLACE pengreen  WITH IIF('+' $ m.frg,255,128)
  7395.    REPLACE penblue   WITH IIF('+' $ m.frg,255,128)
  7396. ENDIF
  7397. IF "N" $ m.frg
  7398.    REPLACE penred    WITH 0
  7399.    REPLACE pengreen  WITH 0
  7400.    REPLACE penblue   WITH 0
  7401. ENDIF
  7402. IF "R" $ m.frg    && red
  7403.    REPLACE penred    WITH IIF('+' $ m.frg,255,128)
  7404. ENDIF
  7405. IF "G" $ m.frg    && green
  7406.    REPLACE pengreen  WITH IIF('+' $ m.frg,255,128)
  7407. ENDIF
  7408. IF "B" $ m.frg    && blue
  7409.    REPLACE penblue   WITH IIF('+' $ m.frg,255,128)
  7410. ENDIF
  7411. REPLACE penred   WITH IIF(penred < 0,0,penred)
  7412. REPLACE pengreen WITH IIF(pengreen < 0,0,pengreen)
  7413. REPLACE penblue  WITH IIF(penblue < 0,0,penblue)
  7414.  
  7415. m.bkg = UPPER(CHRTRANC(SUBSTR(colorpair,AT('/',colorpair)+1,3),'-*/, ',''))
  7416. REPLACE fillred    WITH -1
  7417. REPLACE fillgreen  WITH -1
  7418. REPLACE fillblue   WITH -1
  7419. DO CASE
  7420. CASE m.bkg = "W" OR m.bkg = "W+"    && white
  7421.    REPLACE fillred    WITH IIF('+' $ m.bkg,255,128)
  7422.    REPLACE fillgreen  WITH IIF('+' $ m.bkg,255,128)
  7423.    REPLACE fillblue   WITH IIF('+' $ m.bkg,255,128)
  7424. CASE m.bkg = "N" OR m.bkg = "N+"    && black
  7425.    REPLACE fillred    WITH 0
  7426.    REPLACE fillgreen  WITH 0
  7427.    REPLACE fillblue   WITH 0
  7428. CASE "R" $ m.bkg OR "G" $ m.bkg OR "B" $ m.bkg
  7429.    IF "R" $ m.bkg    && red
  7430.       REPLACE fillred    WITH IIF('+' $ m.bkg,255,128)
  7431.    ENDIF
  7432.    IF "G" $ m.bkg    && green
  7433.       REPLACE fillgreen  WITH IIF('+' $ m.bkg,255,128)
  7434.    ENDIF
  7435.    IF "B" $ m.bkg    && blue
  7436.       REPLACE fillblue   WITH IIF('+' $ m.bkg,255,128)
  7437.    ENDIF
  7438.    REPLACE fillred   WITH IIF(fillred < 0,0,fillred)
  7439.    REPLACE fillgreen WITH IIF(fillgreen < 0,0,fillgreen)
  7440.    REPLACE fillblue  WITH IIF(fillblue < 0,0,fillblue)
  7441. ENDCASE
  7442. RETURN
  7443.  
  7444. * getColor - Return the color value for a specified RGB value.
  7445. *
  7446. *!*****************************************************************************
  7447. *!
  7448. *!       Function: GETCOLOR
  7449. *!
  7450. *!      Called by: CONVERTCOLORPAIR   (procedure in TRANSPRT.PRG)
  7451. *!
  7452. *!*****************************************************************************
  7453. FUNCTION getcolor
  7454. PARAMETER m.rgbstring, m.occurence
  7455. PRIVATE m.comma, m.value
  7456. m.comma = ATC(',', m.rgbstring, m.occurence)
  7457. m.value = SUBSTR(m.rgbstring, m.comma +1, ;
  7458.    ATC(',', m.rgbstring, m.occurence + 1)-m.comma -1)
  7459. RETURN m.value
  7460.  
  7461. *
  7462. *num2style - Return the style string which corresponds to the style
  7463. *         stored in screen database.
  7464. *
  7465. *!*****************************************************************************
  7466. *!
  7467. *!       Function: num2style
  7468. *!
  7469. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  7470. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  7471. *!               : ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  7472. *!               : GETWINDFONT        (procedure in TRANSPRT.PRG)
  7473. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7474. *!
  7475. *!*****************************************************************************
  7476. FUNCTION num2style
  7477. PARAMETER m.stylenum
  7478. PRIVATE m.i, m.strg, m.pow, m.stylechars, m.outstrg
  7479.  
  7480. DO CASE
  7481. CASE TYPE("m.stylenum") = "C"
  7482.    * already a character.  Do nothing.
  7483.    RETURN m.stylenum
  7484. CASE !EMPTY(m.stylenum)
  7485.     m.strg = ""
  7486.     * These are the style characters.  Their position in the string matches the bit
  7487.     * position in the num byte.
  7488.     m.stylechars = "BIUOSCE-"
  7489.  
  7490.     * Look at each of the bits in the stylenum byte
  7491.     FOR m.i = 8 TO 1 STEP -1
  7492.        m.pow = ROUND(2^(i-1),0)
  7493.         IF m.stylenum >= m.pow
  7494.            m.strg = m.strg + SUBSTR(stylechars,m.i,1)
  7495.         ENDIF
  7496.         IF m.pow <> 0
  7497.            m.stylenum = m.stylenum % m.pow
  7498.       ENDIF
  7499.     ENDFOR
  7500.  
  7501.     * Now reverse the string so that style codes appear in the traditional order
  7502.     m.outstrg = ""
  7503.     FOR m.i = 1 TO LEN(m.strg)
  7504.        m.outstrg = m.outstrg + SUBSTR(m.strg,LEN(m.strg)+1-m.i,1)
  7505.     ENDFOR
  7506.     RETURN m.outstrg
  7507. OTHERWISE
  7508.    RETURN ""
  7509. ENDCASE
  7510. *!*****************************************************************************
  7511. *!
  7512. *!       Function: style2num
  7513. *!
  7514. *!*****************************************************************************
  7515. FUNCTION style2num
  7516. * Map style code (e.g., "B") to screen/report numeric style code (e.g., 1)
  7517. PARAMETER m.strg
  7518. PRIVATE m.num, m.i
  7519. m.strg= UPPER(ALLTRIM(m.strg))
  7520. DO CASE
  7521. CASE TYPE("m.strg") $ "NF"
  7522.    * already a number. Do nothing.
  7523.    RETURN m.strg
  7524. CASE !EMPTY(strg)
  7525.     m.num = 0
  7526.     FOR m.i = 1 TO LEN(m.strg)
  7527.        DO CASE
  7528.        CASE SUBSTR(m.strg,i,1) = "B"      && bold
  7529.           m.num = m.num + 1
  7530.        CASE SUBSTR(m.strg,i,1) = "I"         && italic
  7531.           m.num = m.num + 2
  7532.        CASE SUBSTR(m.strg,i,1) = "U"      && underlined
  7533.           m.num = m.num + 4
  7534.        CASE SUBSTR(m.strg,i,1) = "O"      && outline
  7535.           m.num = m.num + 8
  7536.        CASE SUBSTR(m.strg,i,1) = "S"      && shadow
  7537.           m.num = m.num + 16
  7538.        CASE SUBSTR(m.strg,i,1) = "C"         && condensed
  7539.           m.num = m.num + 32
  7540.        CASE SUBSTR(m.strg,i,1) = "E"      && extended
  7541.           m.num = m.num + 64
  7542.        CASE SUBSTR(m.strg,i,1) = "-"      && strikeout
  7543.           m.num = m.num + 128
  7544.        ENDCASE
  7545.     ENDFOR
  7546.     RETURN m.num
  7547. OTHERWISE
  7548.    RETURN 0
  7549. ENDCASE
  7550.  
  7551. *
  7552. * AdjText - Takes the current record and, if it is a multi-line text object, converts it into
  7553. *      multiple single line text objects.
  7554. *
  7555. *!*****************************************************************************
  7556. *!
  7557. *!      Procedure: ADJTEXT
  7558. *!
  7559. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7560. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7561. *!
  7562. *!*****************************************************************************
  7563. PROCEDURE adjtext
  7564. PARAMETER m.oldwidth
  7565.  
  7566. PRIVATE m.saverec
  7567.  
  7568. IF objtype <> c_ottext OR AT(CHR(13), expr) = 0 OR !m.g_grph2char
  7569.    RETURN
  7570. ENDIF
  7571.  
  7572. m.saverec = RECNO()
  7573. SCATTER MEMVAR MEMO
  7574.  
  7575. * Update the original records
  7576. m.expr = SUBSTR(m.expr, 2, LEN(m.expr)-2)
  7577. m.pos = AT(CHR(13), m.expr)
  7578. REPLACE expr WITH '"' + LEFT(m.expr, m.pos-1) + '"'
  7579. REPLACE WIDTH WITH LEN(expr)-2
  7580. DO CASE
  7581. CASE m.picture = '"@J"'                        && Right aligned
  7582.    REPLACE hpos WITH hpos + m.oldwidth - WIDTH
  7583. CASE m.picture = '"@I"'                        && Centered
  7584.    REPLACE hpos WITH hpos + (m.oldwidth - WIDTH)/2
  7585. ENDCASE
  7586. m.expr = SUBSTR(m.expr, m.pos+1)
  7587. m.pos = AT(CHR(13), m.expr)
  7588. REPLACE hpos WITH MAX(0,hpos)
  7589.  
  7590. * Write all records but the last
  7591. DO WHILE m.pos > 0
  7592.    m.vpos = m.vpos + IIF(spacing = 1, m.height * 2, m.height)
  7593.    APPEND BLANK
  7594.    GATHER MEMVAR MEMO
  7595.    REPLACE platform WITH LOWER(platform)
  7596.    REPLACE uniqueid WITH SYS(2015)
  7597.    REPLACE expr WITH '"' + LEFT(m.expr, m.pos-1) + '"'
  7598.    REPLACE WIDTH WITH LEN(expr)-2
  7599.    DO CASE
  7600.    CASE m.picture = '"@J"'                     && Right aligned
  7601.       REPLACE hpos WITH hpos + m.oldwidth - WIDTH
  7602.    CASE m.picture = '"@I"'                     && Centered
  7603.       REPLACE hpos WITH hpos + (m.oldwidth - WIDTH)/2
  7604.    ENDCASE
  7605.  
  7606.    m.expr = SUBSTR(m.expr, m.pos+1)
  7607.    m.pos = AT(CHR(13), m.expr)
  7608.    REPLACE hpos WITH MAX(0,hpos)
  7609. ENDDO
  7610.  
  7611. * Write the last record.
  7612. IF LEN(ALLTRIM(m.expr)) <> 0
  7613.    m.vpos = m.vpos + IIF(spacing = 1, m.height * 2, m.height)
  7614.    APPEND BLANK
  7615.    GATHER MEMVAR MEMO
  7616.    REPLACE platform WITH LOWER(platform)
  7617.    REPLACE uniqueid WITH SYS(2015)
  7618.    REPLACE expr WITH '"' + m.expr + '"'
  7619.    REPLACE WIDTH WITH LEN(expr)-2
  7620.    DO CASE
  7621.    CASE m.picture = '"@J"'                     && Right aligned
  7622.       REPLACE hpos WITH hpos + m.oldwidth - WIDTH
  7623.    CASE m.picture = '"@I"'                     && Centered
  7624.       REPLACE hpos WITH hpos + (m.oldwidth - WIDTH)/2
  7625.    ENDCASE
  7626.    REPLACE hpos WITH MAX(0,hpos)
  7627. ENDIF
  7628.  
  7629. GOTO m.saverec
  7630. RETURN
  7631.  
  7632. *
  7633. *
  7634. * AdjBox - Converts a box/line record from character to graphic or graphic to character
  7635. *
  7636. *!*****************************************************************************
  7637. *!
  7638. *!      Procedure: ADJBOX
  7639. *!
  7640. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7641. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  7642. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7643. *!
  7644. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  7645. *!
  7646. *!*****************************************************************************
  7647. PROCEDURE adjbox
  7648. PARAMETER m.adjust
  7649. DO CASE
  7650. CASE m.g_char2grph
  7651.    DO CASE
  7652.    CASE objcode = c_sgboxd
  7653.       REPLACE pensize WITH 4
  7654.    CASE objcode = c_sgboxp
  7655.       REPLACE pensize WITH 6
  7656.    OTHERWISE
  7657.       REPLACE pensize WITH 1
  7658.    ENDCASE
  7659.  
  7660.    DO CASE
  7661.    CASE height = 1
  7662.       REPLACE height WITH getlinewidth(objcode, .T.)
  7663.       REPLACE vpos WITH vpos + c_adjbox - (HEIGHT/2)
  7664.       IF m.g_filetype = c_screen
  7665.          REPLACE STYLE WITH c_lnhorizontal
  7666.       ENDIF
  7667.  
  7668.       REPLACE penpat  WITH 8
  7669.       REPLACE fillpat WITH 0
  7670.       REPLACE objtype WITH c_otline
  7671.       REPLACE objcode WITH 0
  7672.  
  7673.    CASE WIDTH = 1
  7674.       REPLACE WIDTH WITH getlinewidth(objcode, .F.)
  7675.       REPLACE hpos WITH hpos + c_adjbox - (WIDTH/2)
  7676.       IF m.g_filetype = c_screen
  7677.          REPLACE STYLE WITH c_lnvertical
  7678.       ENDIF
  7679.  
  7680.       REPLACE penpat  WITH 8
  7681.       REPLACE fillpat WITH 0
  7682.       REPLACE objtype WITH c_otline
  7683.       REPLACE objcode WITH 0
  7684.  
  7685.    OTHERWISE
  7686.       REPLACE vpos WITH vpos + c_adjbox - (getlinewidth(objcode, .T.)/2) + m.adjust
  7687.       REPLACE hpos WITH hpos + c_adjbox - (getlinewidth(objcode, .F.)/2) + m.adjust
  7688.       REPLACE height WITH height + getlinewidth(objcode, .T.) - 1
  7689.       REPLACE WIDTH WITH WIDTH + getlinewidth(objcode, .F.) - 1
  7690.  
  7691.       REPLACE penpat  WITH 8
  7692.       REPLACE fillpat WITH 0
  7693.       REPLACE objcode WITH 4
  7694.    ENDCASE
  7695.  
  7696.    IF m.g_filetype = c_screen
  7697.       IF BORDER > 4
  7698.          REPLACE BORDER WITH 1
  7699.       ELSE
  7700.          REPLACE BORDER WITH 0
  7701.       ENDIF
  7702.    ENDIF
  7703. CASE m.g_grph2char
  7704.    ******************* Start Graphic to Character Conversion ******************
  7705.    IF fillpat = 0
  7706.       REPLACE fillchar WITH CHR(0)
  7707.    ELSE
  7708.       REPLACE fillchar WITH " "
  7709.    ENDIF
  7710.  
  7711.    DO CASE
  7712.    CASE pensize = 4
  7713.       REPLACE objcode WITH c_sgboxd
  7714.    CASE pensize = 6
  7715.       REPLACE objcode WITH c_sgboxp
  7716.    OTHERWISE
  7717.       REPLACE objcode WITH c_sgbox
  7718.    ENDCASE
  7719.  
  7720.    DO CASE
  7721.    CASE (m.g_filetype = c_screen AND objtype = c_otline and style = c_lnhorizontal) ;
  7722.         OR (objtype = c_otbox and height <=1)
  7723.       REPLACE vpos WITH vpos - c_adjbox
  7724.       REPLACE height WITH 1
  7725.    CASE (m.g_filetype = c_screen AND objtype = c_otline and style = c_lnvertical) ;
  7726.         OR (objtype = c_otbox and width <=1)
  7727.       REPLACE hpos WITH hpos-c_adjbox
  7728.       REPLACE width WITH 1
  7729.    OTHERWISE
  7730.       REPLACE vpos WITH vpos-c_adjbox
  7731.       REPLACE hpos WITH hpos-c_adjbox
  7732.       REPLACE height WITH height+(c_adjbox*2)
  7733.       REPLACE WIDTH WITH WIDTH+(c_adjbox*2)
  7734.    ENDCASE
  7735. ENDCASE
  7736. RETURN
  7737.  
  7738. *
  7739. * GetLineWidth - Given an object code for a box or line and a flag indicating
  7740. *      if we want the thickness of a horizontal or vertical size, we return
  7741. *      the thickness of the side.
  7742. *
  7743. *!*****************************************************************************
  7744. *!
  7745. *!       Function: GETLINEWIDTH
  7746. *!
  7747. *!      Called by: JOINHORIZONTAL     (procedure in TRANSPRT.PRG)
  7748. *!               : JOINVERTICAL       (procedure in TRANSPRT.PRG)
  7749. *!               : REJOINBOXES        (procedure in TRANSPRT.PRG)
  7750. *!               : JOINLINEWIDTH()    (function  in TRANSPRT.PRG)
  7751. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  7752. *!
  7753. *!*****************************************************************************
  7754. FUNCTION getlinewidth
  7755. PARAMETERS m.objcode, m.horizontal
  7756.  
  7757. IF _WINDOWS OR _MAC
  7758.    DO CASE
  7759.    CASE m.objcode = c_sgboxd
  7760.       IF m.g_filetype = c_report
  7761.          RETURN 4 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle)
  7762.       ELSE
  7763.          RETURN 4 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_dfltfface, m.g_dfltfsize, "B")
  7764.       ENDIF
  7765.  
  7766.    CASE m.objcode = c_sgboxp
  7767.       IF m.g_filetype = c_report
  7768.          RETURN 6 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle)
  7769.       ELSE
  7770.          RETURN 6 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_dfltfface, m.g_dfltfsize, "B")
  7771.       ENDIF
  7772.  
  7773.    OTHERWISE
  7774.       IF m.g_filetype = c_report
  7775.          RETURN 1 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle)
  7776.       ELSE
  7777.          RETURN 1 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_dfltfface, m.g_dfltfsize, "B")
  7778.       ENDIF
  7779.    ENDCASE
  7780. ELSE
  7781.    RETURN 1
  7782. ENDIF
  7783.  
  7784. *
  7785. * HorizButton - Will return a .T. if the ojbect passed in is a series of
  7786. *            horizontal buttons.  If they are vertical buttons, it
  7787. *            returns .F.
  7788. *
  7789. *!*****************************************************************************
  7790. *!
  7791. *!       Function: HORIZBUTTON
  7792. *!
  7793. *!      Called by: CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  7794. *!               : FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  7795. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  7796. *!               : ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  7797. *!               : ADJINVBTNS         (procedure in TRANSPRT.PRG)
  7798. *!               : GETLASTOBJECTLINE()(function  in TRANSPRT.PRG)
  7799. *!               : GETOBJWIDTH()      (function  in TRANSPRT.PRG)
  7800. *!               : GETOBJHEIGHT()     (function  in TRANSPRT.PRG)
  7801. *!
  7802. *!*****************************************************************************
  7803. FUNCTION horizbutton
  7804. PARAMETER m.pictclause
  7805.  
  7806. IF OCCURS(';', m.pictclause) = 0 OR ;
  7807.       AT("H", LEFT(m.pictclause, AT(" ", m.pictclause))) != 0
  7808.    RETURN .T.
  7809. ELSE
  7810.    RETURN .F.
  7811. ENDIF
  7812.  
  7813. *
  7814. * MaxBtnWidth - Given the Picture clause for a set of buttons (text or
  7815. *      radio) along with its font information and returns the Width in
  7816. *      foxels of the widest label.
  7817. *
  7818. *!*****************************************************************************
  7819. *!
  7820. *!       Function: MAXBTNWIDTH
  7821. *!
  7822. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7823. *!
  7824. *!*****************************************************************************
  7825. FUNCTION maxbtnwidth
  7826. PARAMETERS m.picture, m.face, m.size, m.style
  7827. PRIVATE m.max, m.label
  7828.  
  7829. m.max = 0
  7830. m.picture = SUBSTR(m.picture, AT(" ", m.picture))
  7831.  
  7832. m.picture = STRTRAN(m.picture, "\\", "")
  7833. m.picture = STRTRAN(m.picture, "\<", "")
  7834. m.picture = STRTRAN(m.picture, "\!", "")
  7835. m.picture = STRTRAN(m.picture, "\?", "")
  7836.  
  7837. DO WHILE LEN(m.picture) != 0
  7838.    IF AT(";", m.picture) != 0
  7839.       m.label = ALLTRIM(LEFT(m.picture, AT(";", m.picture)-1))
  7840.       m.picture = SUBSTR(m.picture, AT(";", m.picture)+1)
  7841.    ELSE
  7842.       m.label = ALLTRIM(LEFT(m.picture, LEN(m.picture)-1))
  7843.       m.picture = ""
  7844.    ENDIF
  7845.  
  7846.    DO CASE
  7847.    CASE m.g_char2grph OR m.g_grph2grph
  7848.       m.max = MAX(m.max, TXTWIDTH(m.label, m.face, m.size, m.style))
  7849.    CASE m.g_grph2char
  7850.       m.max = MAX(m.max, LEN(m.label))
  7851.    ENDCASE
  7852. ENDDO
  7853.  
  7854. RETURN m.max
  7855.  
  7856. *
  7857. * GetObjWidth - Given a screen object, this function returns its Width.
  7858. *
  7859. *!*****************************************************************************
  7860. *!
  7861. *!       Function: GETOBJWIDTH
  7862. *!
  7863. *!      Called by: ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  7864. *!               : GETRIGHTMOST       (procedure in TRANSPRT.PRG)
  7865. *!
  7866. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  7867. *!
  7868. *!*****************************************************************************
  7869. FUNCTION getobjwidth
  7870. PARAMETERS m.objtype, m.picture, m.width, m.spacing, m.platform
  7871. PRIVATE m.numitems
  7872.  
  7873. DO CASE
  7874. CASE m.objtype = c_ottext OR m.objtype = c_otfield OR ;
  7875.       m.objtype = c_otline OR m.objtype = c_otbox OR ;
  7876.       m.objtype = c_otlist OR m.objtype = c_otchkbox OR ;
  7877.       m.objtype = c_otpopup OR m.objtype = c_otpicture OR ;
  7878.       m.objtype = c_otspinner OR m.objtype = c_otrepfld
  7879.    RETURN m.width
  7880.  
  7881. CASE m.objtype = c_ottxtbut OR m.objtype = c_otradbut OR m.objtype = c_otinvbut
  7882.    m.numitems = OCCURS(";", m.picture) + 1
  7883.    IF !horizbutton(m.picture) OR m.numitems = 1
  7884.       RETURN m.width
  7885.    ELSE
  7886.       RETURN (m.width * m.numitems) + (m.spacing * (m.numitems - 1))
  7887.    ENDIF
  7888.  
  7889. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7890.       (m.platform = c_macname OR m.platform = c_winname)
  7891.    RETURN m.width
  7892.  
  7893. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7894.       (m.platform = c_dosname OR m.platform = c_unixname)
  7895.    RETURN m.width-1
  7896.  
  7897. OTHERWISE
  7898.    RETURN m.width
  7899. ENDCASE
  7900.  
  7901. *
  7902. * GetObjHeight - Given a screen object, this function returns its Height.
  7903. *
  7904. *!*****************************************************************************
  7905. *!
  7906. *!       Function: GETOBJHEIGHT
  7907. *!
  7908. *!      Called by: GETLOWEST          (procedure in TRANSPRT.PRG)
  7909. *!
  7910. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  7911. *!
  7912. *!*****************************************************************************
  7913. FUNCTION getobjheight
  7914. PARAMETERS m.objtype, m.picture, m.height, m.spacing, m.platform
  7915. PRIVATE m.numitems
  7916.  
  7917. DO CASE
  7918. CASE m.objtype = c_ottext OR m.objtype = c_otfield OR ;
  7919.       m.objtype = c_otline OR m.objtype = c_otbox OR ;
  7920.       m.objtype = c_otlist OR m.objtype = c_otchkbox OR ;
  7921.       m.objtype = c_otpopup OR m.objtype = c_otpicture OR ;
  7922.       m.objtype = c_otspinner OR m.objtype = c_otrepfld
  7923.    RETURN m.height
  7924.  
  7925. CASE m.objtype = c_ottxtbut OR m.objtype = c_otradbut OR ;
  7926.       m.objtype = c_otinvbut
  7927.    m.numitems = OCCURS(";", m.picture) + 1
  7928.  
  7929.    IF horizbutton(m.picture) OR m.numitems = 1
  7930.       RETURN m.height
  7931.    ELSE
  7932.       RETURN (m.height * m.numitems) + (m.spacing * (m.numitems - 1))
  7933.    ENDIF
  7934.  
  7935. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7936.       (m.platform = c_macname OR m.platform = c_winname)
  7937.    RETURN m.height
  7938.  
  7939. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7940.       (m.platform = c_dosname OR m.platform = c_unixname)
  7941.    RETURN m.height-1
  7942.  
  7943. OTHERWISE
  7944.    RETURN m.height
  7945. ENDCASE
  7946.  
  7947. *
  7948. * GetRightmost - Takes a platform and returns the rightmost position occupied by an object
  7949. *      in that platform
  7950. *!*****************************************************************************
  7951. *!
  7952. *!      Procedure: GETRIGHTMOST
  7953. *!
  7954. *!      Called by: MAKECHARFIT        (procedure in TRANSPRT.PRG)
  7955. *!
  7956. *!          Calls: GETOBJWIDTH()      (function  in TRANSPRT.PRG)
  7957. *!
  7958. *!*****************************************************************************
  7959. PROCEDURE getrightmost
  7960. PARAMETER m.platform
  7961. PRIVATE m.right
  7962.  
  7963. m.right = 0
  7964.  
  7965. SCAN FOR platform = m.platform AND !DELETED() AND ;
  7966.       (objtype = c_ottext OR objtype = c_otline OR ;
  7967.       objtype = c_otbox OR objtype = c_otrepfld OR ;
  7968.       objtype = c_otlist OR objtype = c_ottxtbut OR ;
  7969.       objtype = c_otradbut OR objtype = c_otchkbox OR ;
  7970.       objtype = c_otfield OR objtype = c_otpopup OR ;
  7971.       objtype = c_otpicture OR objtype = c_otinvbut OR ;
  7972.       objtype = c_otspinner)
  7973.    m.right = MAX(m.right, hpos + getobjwidth(objtype, PICTURE, WIDTH, spacing, m.g_toplatform))
  7974. ENDSCAN
  7975.  
  7976. RETURN m.right
  7977.  
  7978. *
  7979. * GetLowest - Takes a platform and returns the lowest position occupied by an object
  7980. *      in that platform
  7981. *!*****************************************************************************
  7982. *!
  7983. *!      Procedure: GETLOWEST
  7984. *!
  7985. *!      Called by: MAKECHARFIT        (procedure in TRANSPRT.PRG)
  7986. *!
  7987. *!          Calls: GETOBJHEIGHT()     (function  in TRANSPRT.PRG)
  7988. *!
  7989. *!*****************************************************************************
  7990. PROCEDURE getlowest
  7991. PARAMETER m.platform
  7992. PRIVATE m.bottom
  7993.  
  7994. m.bottom = 0
  7995.  
  7996. SCAN FOR platform = m.platform AND !DELETED() AND ;
  7997.       (objtype = c_ottext OR objtype = c_otline OR ;
  7998.       objtype = c_otbox OR objtype = c_otrepfld OR ;
  7999.       objtype = c_otlist OR objtype = c_ottxtbut OR ;
  8000.       objtype = c_otradbut OR objtype = c_otchkbox OR ;
  8001.       objtype = c_otfield OR objtype = c_otpopup OR ;
  8002.       objtype = c_otpicture OR objtype = c_otinvbut OR ;
  8003.       objtype = c_otspinner)
  8004.    m.bottom = MAX(m.bottom, vpos + getobjheight(objtype, PICTURE, HEIGHT, spacing, m.g_toplatform))
  8005. ENDSCAN
  8006.  
  8007. RETURN m.bottom
  8008.  
  8009. *
  8010. * DoCreate - Creates an empty cursor with either a report or screen structure and a given name.
  8011. *
  8012. *!*****************************************************************************
  8013. *!
  8014. *!      Procedure: DOCREATE
  8015. *!
  8016. *!      Called by: cvrt102FRX()    (function  in TRANSPRT.PRG)
  8017. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  8018. *!               : MAKECURSOR         (procedure in TRANSPRT.PRG)
  8019. *!               : WRITERESULT        (procedure in TRANSPRT.PRG)
  8020. *!
  8021. *!*****************************************************************************
  8022. PROCEDURE docreate
  8023. PARAMETER m.name, m.type
  8024. DO CASE
  8025. CASE m.type = c_screen
  8026.    CREATE CURSOR (m.name) (platform C(8), uniqueid C(10), timestamp N(10), objtype N(2), objcode N(3), ;
  8027.       name m, expr m, vpos N(7,3), hpos N(7,3), HEIGHT N(7,3), WIDTH N(7,3), ;
  8028.       STYLE N(2), PICTURE m, ORDER m, "unique" l, comment m, ENVIRON l, ;
  8029.       boxchar C(1), fillchar C(1), TAG m, tag2 m, penred N(5), pengreen N(5), ;
  8030.       penblue N(5), fillred N(5), fillgreen N(5), fillblue N(5), pensize N(5), ;
  8031.       penpat N(5), fillpat N(5), fontface m, fontstyle N(3), fontsize N(3), ;
  8032.       mode N(3), ruler N(1), rulerlines N(1), grid l, gridv N(2), gridh N(2), ;
  8033.       SCHEME N(2), scheme2 N(2), colorpair C(8), lotype N(1), rangelo m, ;
  8034.       hitype N(1), rangehi m, whentype N(1), WHEN m, validtype N(1), VALID m, ;
  8035.       errortype N(1), ERROR m, messtype N(1), MESSAGE m, showtype N(1), SHOW m, ;
  8036.       activtype N(1), ACTIVATE m, deacttype N(1), DEACTIVATE m, proctype N(1), ;
  8037.       proccode m, setuptype N(1), setupcode m, FLOAT l, CLOSE l, MINIMIZE l, ;
  8038.       BORDER N(1), SHADOW l, CENTER l, REFRESH l, disabled l, scrollbar l, ;
  8039.       addalias l, TAB l, initialval m, initialnum N(3), spacing N(6,3), curpos l)
  8040.  
  8041. CASE m.type = c_report OR m.type = c_label
  8042.     *- added user field for 3.0 reports (11/14/95 jd)
  8043.    CREATE CURSOR (m.name) (platform C(8), uniqueid C(10), timestamp N(10), objtype N(2), objcode N(3), ;
  8044.       name m, expr m, vpos N(9,3), hpos N(9,3), HEIGHT N(9,3), WIDTH N(9,3), ;
  8045.       STYLE m, PICTURE m, ORDER m, "unique" l, comment m, ENVIRON l, ;
  8046.       boxchar C(1), fillchar C(1), TAG m, tag2 m, penred N(5), pengreen N(5), ;
  8047.       penblue N(5), fillred N(5), fillgreen N(5), fillblue N(5), pensize N(5), ;
  8048.       penpat N(5), fillpat N(5), fontface m, fontstyle N(3), fontsize N(3), ;
  8049.       mode N(3), ruler N(1), rulerlines N(1), grid l, gridv N(2), gridh N(2), ;
  8050.       FLOAT l, STRETCH l, stretchtop l, TOP l, BOTTOM l, suptype N(1), suprest N(1), ;
  8051.       norepeat l, resetrpt N(2), pagebreak l, colbreak l, resetpage l, GENERAL N(3), ;
  8052.       spacing N(3), DOUBLE l, swapheader l, swapfooter l, ejectbefor l, ejectafter l, ;
  8053.       PLAIN l, SUMMARY l, addalias l, offset N(3), topmargin N(3), botmargin N(3), ;
  8054.       totaltype N(2), resettotal N(2), resoid N(3), curpos l, supalways l, supovflow l, ;
  8055.       suprpcol N(1), supgroup N(2), supvalchng l, supexpr m, user m)
  8056. CASE m.type = c_project
  8057.    CREATE CURSOR (m.name) ;
  8058.       (name m, ;
  8059.       TYPE C(1), ;
  8060.       timestamp N(10), ;
  8061.       outfile m, ;
  8062.       homedir m, ;
  8063.       setid N(4), ;
  8064.       exclude l, ;
  8065.       mainprog l, ;
  8066.       arranged m, ;
  8067.       savecode l, ;
  8068.       defname l, ;
  8069.       openfiles l, ;
  8070.       closefiles l, ;
  8071.       defwinds l, ;
  8072.       relwinds l, ;
  8073.       readcycle l, ;
  8074.       multreads l, ;
  8075.       NOLOCK l, ;
  8076.       MODAL l, ;
  8077.       assocwinds m, ;
  8078.       DEBUG l, ;
  8079.       ENCRYPT l, ;
  8080.       nologo l, ;
  8081.       scrnorder N(3), ;
  8082.       cmntstyle N(1), ;
  8083.       objrev N(5), ;
  8084.       commands m, ;
  8085.       devinfo m, ;
  8086.       symbols m, ;
  8087.       OBJECT m, ;
  8088.       ckval N(6) ;
  8089.       )
  8090. ENDCASE
  8091. RETURN
  8092.  
  8093. *
  8094. * makecursor - Create a cursor with the structure we need for this file on the 2.5 platform.
  8095. *
  8096. *!*****************************************************************************
  8097. *!
  8098. *!      Procedure: MAKECURSOR
  8099. *!
  8100. *!      Called by: TRANSPRT.PRG
  8101. *!               : CONVERTER          (procedure in TRANSPRT.PRG)
  8102. *!
  8103. *!          Calls: DOCREATE           (procedure in TRANSPRT.PRG)
  8104. *!
  8105. *!*****************************************************************************
  8106. PROCEDURE makecursor
  8107. PRIVATE m.temp20alias, m.in_del
  8108.  
  8109. LOCAL cOldCPTrans, m.cTag2
  8110. cOldCPTrans = SET("NOCPTRANS")
  8111.  
  8112. m.temp20alias = "S"+SUBSTR(LOWER(SYS(3)),2,8)
  8113. DO docreate WITH m.temp20alias, m.g_filetype
  8114. m.in_del = SET("DELETED")
  8115. SET DELETED ON
  8116. IF TYPE("tag") == 'C' AND TYPE("tag2") == 'C'    && make sure the fields are there (RED00VZ1 jd 06/20/96)
  8117.     SET NOCPTRANS TO tag, tag2
  8118. ENDIF
  8119. APPEND FROM (m.g_scrndbf)
  8120. IF TYPE("tag") == 'C' AND TYPE("tag2") == 'C'    && make sure the fields are there (RED00VZ1 jd 06/20/96)
  8121.     *- codepage translation workaround
  8122.     GO TOP
  8123.     IF !EMPTY(tag2)
  8124.         SELECT (g_scrnalias)
  8125.         GO TOP
  8126.         m.cTag2 = tag2
  8127.         SELECT (m.temp20alias)
  8128.         GO TOP
  8129.         REPLACE tag2 WITH m.cTag2
  8130.     ENDIF
  8131. ENDIF
  8132. SET NOCPTRANS TO &cOldCPTrans
  8133. SET DELETED &in_del
  8134.  
  8135. m.g_20alias = m.g_scrnalias
  8136. m.g_scrnalias = m.temp20alias
  8137.  
  8138.  
  8139. *
  8140. * AddGraphicalLabelGroups - Add page and column header records for a label.
  8141. *
  8142. *!*****************************************************************************
  8143. *!
  8144. *!      Procedure: ADDGRAPHICALLABELGROUPS
  8145. *!
  8146. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  8147. *!               : UPDATELABELDATA    (procedure in TRANSPRT.PRG)
  8148. *!
  8149. *!*****************************************************************************
  8150. PROCEDURE addgraphicallabelgroups
  8151.  
  8152. IF m.g_char2grph
  8153.    * First make sure that we don't already have these headers.  Check for a page header.
  8154.    LOCATE FOR objtype = c_otband AND objcode = 1
  8155.    IF FOUND()
  8156.       * We already have a page header.  We don't want two.  Reports, like people, function
  8157.       * best with only a single head.
  8158.       RETURN
  8159.    ENDIF
  8160.  
  8161.    APPEND BLANK
  8162.    REPLACE objtype WITH c_otband
  8163.    REPLACE objcode WITH 1
  8164.    REPLACE height WITH 0
  8165.    REPLACE pagebreak WITH .F.
  8166.    REPLACE colbreak WITH .F.
  8167.    REPLACE resetpage WITH .F.
  8168.    REPLACE platform WITH m.g_toplatform
  8169.    REPLACE uniqueid WITH SYS(2015)
  8170.  
  8171.    APPEND BLANK
  8172.    REPLACE objtype WITH c_otband
  8173.    REPLACE objcode WITH 2
  8174.    REPLACE height WITH 0
  8175.    REPLACE pagebreak WITH .F.
  8176.    REPLACE colbreak WITH .F.
  8177.    REPLACE resetpage WITH .F.
  8178.    REPLACE platform WITH m.g_toplatform
  8179.    REPLACE uniqueid WITH SYS(2015)
  8180.  
  8181.    APPEND BLANK
  8182.    REPLACE objtype WITH c_otband
  8183.    REPLACE objcode WITH 6
  8184.    REPLACE height WITH 0
  8185.    REPLACE pagebreak WITH .F.
  8186.    REPLACE colbreak WITH .F.
  8187.    REPLACE resetpage WITH .F.
  8188.    REPLACE platform WITH m.g_toplatform
  8189.    REPLACE uniqueid WITH SYS(2015)
  8190.  
  8191.    APPEND BLANK
  8192.    REPLACE objtype WITH c_otband
  8193.    REPLACE objcode WITH 7
  8194.    REPLACE height WITH 0
  8195.    REPLACE pagebreak WITH .F.
  8196.    REPLACE colbreak WITH .F.
  8197.    REPLACE resetpage WITH .F.
  8198.    REPLACE platform WITH m.g_toplatform
  8199.    REPLACE uniqueid WITH SYS(2015)
  8200. ENDIF
  8201.  
  8202. *
  8203. * UpdateLabelData - Labels live in report dataases now and we need to add at least one band
  8204. *            record if we are coming from a 2.0 label.
  8205. *
  8206. *!*****************************************************************************
  8207. *!
  8208. *!      Procedure: UPDATELABELDATA
  8209. *!
  8210. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8211. *!
  8212. *!          Calls: ADDGRAPHICALLABELGR(procedure in TRANSPRT.PRG)
  8213. *!
  8214. *!*****************************************************************************
  8215. PROCEDURE updatelabeldata
  8216. PARAMETER m.lbxnumacross, m.lbxlmargin, m.lbxspacesbet, m.lbxlinesbet, m.lbxheight
  8217.  
  8218. DO addgraphicallabelgroups
  8219.  
  8220. * We need a detail band for any platform.
  8221. APPEND BLANK
  8222. REPLACE objtype WITH c_otband
  8223. REPLACE objcode WITH 4
  8224. REPLACE height WITH m.lbxheight
  8225. REPLACE pagebreak WITH .F.
  8226. REPLACE colbreak WITH .F.
  8227. REPLACE resetpage WITH .F.
  8228.  
  8229. LOCATE FOR objtype = c_ot20label
  8230. IF FOUND()
  8231.    REPLACE vpos WITH m.lbxnumacross
  8232.    REPLACE hpos WITH m.lbxlmargin
  8233.    REPLACE height WITH m.lbxspacesbet
  8234.    REPLACE penblue WITH m.lbxlinesbet
  8235. ENDIF
  8236.  
  8237. *
  8238. * PlatformDefaults - Writes information to a record that would not exist on the source platform and
  8239. *         we don't add elsewhere.
  8240. *
  8241. *!*****************************************************************************
  8242. *!
  8243. *!      Procedure: PLATFORMDEFAULTS
  8244. *!
  8245. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8246. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  8247. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  8248. *!
  8249. *!*****************************************************************************
  8250. PROCEDURE platformdefaults
  8251. PARAMETER m.timestamp
  8252.  
  8253. IF m.timestamp > 0
  8254.    REPLACE uniqueid WITH SYS(2015)
  8255.    REPLACE timestamp WITH m.timestamp
  8256.    REPLACE platform WITH m.g_fromplatform
  8257. ENDIF
  8258.  
  8259. IF m.g_char2grph
  8260.    REPLACE ruler WITH 1             && inches
  8261.    REPLACE rulerlines WITH 1
  8262.    REPLACE grid WITH .T.
  8263.    REPLACE gridv WITH 9
  8264.    REPLACE gridh WITH 9
  8265. ENDIF
  8266.  
  8267. *
  8268. * converter - Convert a 2.0 screen or report to 2.5 format and fill in the
  8269. *            appropriate fields.
  8270. *
  8271. *!*****************************************************************************
  8272. *!
  8273. *!      Procedure: CONVERTER
  8274. *!
  8275. *!      Called by: TRANSPRT.PRG
  8276. *!
  8277. *!          Calls: MAKECURSOR         (procedure in TRANSPRT.PRG)
  8278. *!               : UPDATELABELDATA    (procedure in TRANSPRT.PRG)
  8279. *!               : CONVERTPROJECT     (procedure in TRANSPRT.PRG)
  8280. *!               : STAMPVAL()         (function  in TRANSPRT.PRG)
  8281. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  8282. *!               : UPDATEVERSION      (procedure in TRANSPRT.PRG)
  8283. *!
  8284. *!*****************************************************************************
  8285. PROCEDURE converter
  8286. PRIVATE m.lbxnumacross, m.lbxlmargin, m.lbxspacesbet, m.lbxlinesbet, m.lbxheight, m.timestamp
  8287.  
  8288. DO CASE
  8289. CASE m.g_filetype = c_label
  8290.    LOCATE FOR objtype = c_ot20label
  8291.    IF FOUND()
  8292.       m.lbxnumacross   = numacross
  8293.       m.lbxlmargin     = lmargin
  8294.       m.lbxspacesbet   = spacesbet
  8295.       m.lbxlinesbet    = linesbet
  8296.       m.lbxheight      = HEIGHT
  8297.    ENDIF
  8298. ENDCASE
  8299.  
  8300. DO makecursor
  8301.  
  8302. DO CASE
  8303. CASE m.g_filetype = c_label
  8304.    DO updatelabeldata WITH m.lbxnumacross, m.lbxlmargin, m.lbxspacesbet, m.lbxlinesbet, m.lbxheight
  8305. CASE m.g_filetype = c_project
  8306.    DO convertproject
  8307.    RETURN
  8308. ENDCASE
  8309.  
  8310. m.timestamp = stampval()
  8311. SCAN
  8312.    DO platformdefaults WITH m.timestamp
  8313. ENDSCAN
  8314.  
  8315. DO updateversion
  8316.  
  8317. *
  8318. * UpdateVersion - Places the correct version number in the m.g_fromPlatfrom
  8319. *      records.
  8320. *!*****************************************************************************
  8321. *!
  8322. *!      Procedure: UPDATEVERSION
  8323. *!
  8324. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8325. *!
  8326. *!*****************************************************************************
  8327. PROCEDURE updateversion
  8328. LOCATE FOR platform = c_dosname AND objtype = c_otheader
  8329. IF FOUND()
  8330.    DO CASE
  8331.    CASE m.g_filetype = c_screen
  8332.       REPLACE objcode WITH c_25scx
  8333.    OTHERWISE
  8334.       REPLACE objcode WITH c_25frx
  8335.    ENDCASE
  8336. ENDIF
  8337.  
  8338. *
  8339. * SynchTime - Takes the names of two platforms and makes the timestamp of the header (objectype = 1)
  8340. *      record for the first platfrom match the timestamp of the header record of the second.
  8341. *
  8342. *!*****************************************************************************
  8343. *!
  8344. *!      Procedure: SYNCHTIME
  8345. *!
  8346. *!      Called by: TRANSPRT.PRG
  8347. *!
  8348. *!*****************************************************************************
  8349. PROCEDURE synchtime
  8350. PARAMETER m.convertedplatform, m.matchplatform
  8351. PRIVATE m.timestamp
  8352. LOCATE FOR platform = m.matchplatform AND objtype = c_otheader
  8353. IF FOUND()
  8354.    m.timestamp = timestamp
  8355.    LOCATE FOR platform = m.convertedplatform AND objtype = c_otheader
  8356.    IF FOUND()
  8357.       REPLACE timestamp WITH m.timestamp
  8358.    ENDIF
  8359. ENDIF
  8360.  
  8361. *
  8362. * Get a timestamp value based on the current date and time.
  8363. *
  8364. *!*****************************************************************************
  8365. *!
  8366. *!       Function: STAMPVAL
  8367. *!
  8368. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8369. *!
  8370. *!          Calls: SHIFTL()           (function  in TRANSPRT.PRG)
  8371. *!               : SHIFTR()           (function  in TRANSPRT.PRG)
  8372. *!
  8373. *!*****************************************************************************
  8374. FUNCTION stampval
  8375. PRIVATE m.dateval, m.timeval
  8376.  
  8377. m.dateval = DAY(DATE()) + ;
  8378.    shiftl(MONTH(DATE()), 5) + ;
  8379.    shiftl(YEAR(DATE())-1980, 9)
  8380.  
  8381. m.timeval = shiftr(VAL(RIGHT(TIME(),2)),1) + ;
  8382.    shiftl(VAL(SUBSTR(TIME(),4,2)),5) + ;
  8383.    shiftl(VAL(LEFT(TIME(),2)),11)
  8384.  
  8385. RETURN shiftl(m.dateval,16)+m.timeval
  8386.  
  8387. *
  8388. * Shift a value x times to the left.  (This isn't a true match for
  8389. * a shift since we keep extending the value without truncating it,
  8390. * but it works for us.)
  8391. *
  8392. *!*****************************************************************************
  8393. *!
  8394. *!       Function: SHIFTL
  8395. *!
  8396. *!      Called by: STAMPVAL()         (function  in TRANSPRT.PRG)
  8397. *!
  8398. *!*****************************************************************************
  8399. FUNCTION shiftl
  8400. PARAMETER m.value, m.times
  8401. PRIVATE m.loop
  8402.  
  8403. FOR m.loop = 1 TO m.times
  8404.    m.value = m.value * 2
  8405. ENDFOR
  8406. RETURN m.value
  8407.  
  8408. *
  8409. * Shift a value x times to the right.  (This isn't a true match for
  8410. * a shift since we keep extending the value without truncating it,
  8411. * but it works for us.)
  8412. *
  8413. *!*****************************************************************************
  8414. *!
  8415. *!       Function: SHIFTR
  8416. *!
  8417. *!      Called by: STAMPVAL()         (function  in TRANSPRT.PRG)
  8418. *!
  8419. *!*****************************************************************************
  8420. FUNCTION shiftr
  8421. PARAMETER m.value, m.times
  8422. PRIVATE m.loop
  8423.  
  8424. FOR m.loop = 1 TO m.times
  8425.    m.value = INT(m.value / 2)
  8426. ENDFOR
  8427. RETURN m.value
  8428.  
  8429. *
  8430. * EmptyPlatform - Takes a platform ID and returns .T. if no records for that platform
  8431. *       are in the file or .F. if some are present.
  8432. *
  8433. *!*****************************************************************************
  8434. *!
  8435. *!       Function: EMPTYPLATFORM
  8436. *!
  8437. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  8438. *!
  8439. *!*****************************************************************************
  8440. FUNCTION emptyplatform
  8441. PARAMETER m.platform
  8442. PRIVATE m.count
  8443. SELECT (m.g_scrnalias)
  8444.  
  8445. IF (FCOUNT() = c_20scxfld OR FCOUNT() = c_20frxfld OR FCOUNT() = c_20lbxfld)
  8446.    RETURN .T.
  8447. ENDIF
  8448.  
  8449. COUNT TO m.count FOR platform = m.platform
  8450. IF m.count > 0
  8451.    RETURN .F.
  8452. ELSE
  8453.    RETURN .T.
  8454. ENDIF
  8455.  
  8456. **
  8457. ** Code Associated With Displaying the 2.0 to 2.5 conversion dialog.
  8458. **
  8459. *!*****************************************************************************
  8460. *!
  8461. *!       Function: STRUCTDIALOG
  8462. *!
  8463. *!      Called by: DOUPDATE()         (function  in TRANSPRT.PRG)
  8464. *!
  8465. *!          Calls: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  8466. *!               : CURPOS()           (function  in TRANSPRT.PRG)
  8467. *!
  8468. *!*****************************************************************************
  8469. FUNCTION structdialog
  8470. PARAMETER m.textline
  8471. PRIVATE m.choice, m.ftype, m.dlgwidth, m.fnt_ratio
  8472.  
  8473. DO CASE
  8474. CASE m.g_filetype = c_screen
  8475.    m.ftype = "screen "
  8476. CASE m.g_filetype = c_report
  8477.    m.ftype = "report "
  8478. CASE m.g_filetype = c_label
  8479.    m.ftype = "label "
  8480. CASE m.g_filetype = c_project
  8481.    m.ftype = "project "
  8482. OTHERWISE
  8483.    m.ftype = ""
  8484. ENDCASE
  8485.  
  8486. m.dlgwidth = 60    && default
  8487. DO CASE
  8488. CASE _WINDOWS
  8489.     *- no dialog if Windows (conversion dialog should be enough) (jd 2/6/95)
  8490.     =UpdTherm(10)
  8491.     RETURN .T.    && RETURN (MESSAGEBOX(m.textline,4,C_MSGBOXTITLE_LOC) == 6)
  8492. CASE _mac
  8493.     *- no dialog if Mac (conversion dialog should be enough) (jd 03/24/96)
  8494.     =UpdTherm(10)
  8495.     RETURN .T.
  8496. CASE _WINDOWS OR _MAC
  8497.    IF NOT WEXIST("tstructd")
  8498.         IF _MAC
  8499.             m.dlgwidth = 40
  8500.           DEFINE WINDOW tstructd ;
  8501.              AT 0,0 ;
  8502.              SIZE 5.076,m.dlgwidth ;
  8503.              TITLE "Converter" ;
  8504.              FONT m.g_tdlgface, m.g_tdlgsize ;
  8505.              STYLE m.g_tdlgstyle ;
  8506.              FLOAT ;
  8507.              NOCLOSE ;
  8508.              MINIMIZE ;
  8509.              SYSTEM  ;
  8510.              COLOR RGB(0, 0, 0, 192, 192, 192)
  8511.         ELSE
  8512.             m.dlgwidth = 58.333
  8513.         *- added color to Windows screen (jd 11/15/94)
  8514.           DEFINE WINDOW tstructd ;
  8515.              AT 0,0 ;
  8516.              SIZE 5.076,m.dlgwidth ;
  8517.              TITLE "Converter" ;
  8518.              FONT m.g_tdlgface, m.g_tdlgsize ;
  8519.              STYLE m.g_tdlgstyle ;
  8520.              FLOAT ;
  8521.              CLOSE ;
  8522.              MINIMIZE ;
  8523.              SYSTEM  ;
  8524.             COLOR RGB(0, 0, 0, 192, 192, 192)
  8525.         ENDIF
  8526.       MOVE WINDOW tstructd CENTER
  8527.    ENDIF
  8528.  
  8529.    IF WVISIBLE("tstructd")
  8530.       ACTIVATE WINDOW tstructd SAME
  8531.    ELSE
  8532.       ACTIVATE WINDOW tstructd NOSHOW
  8533.    ENDIF
  8534.  
  8535.     * Adjust for differences between dialog window font and text font
  8536.     m.fnt_ratio =     FONTMETRIC(6,m.g_tdlgface, m.g_tdlgsize, m.g_tdlgsty2) ;
  8537.                   / FONTMETRIC(6,m.g_tdlgface, m.g_tdlgsize, m.g_tdlgstyle)
  8538.  
  8539.    @ 1.000, (m.dlgwidth - TXTWIDTH(m.textline, m.g_tdlgface, m.g_tdlgsize, m.g_tdlgstyle) * m.fnt_ratio) / 2 ;
  8540.       SAY m.textline ;
  8541.       SIZE 1.154,TXTWIDTH(m.textline, m.g_tdlgface, m.g_tdlgsize, m.g_tdlgstyle) ;
  8542.       FONT m.g_tdlgface, m.g_tdlgsize ;
  8543.       STYLE m.g_tdlgsty2
  8544.  
  8545.    @ 2.750, m.dlgwidth/2 - (13.5*2+4.308)/2 GET m.choice ;
  8546.       PICTURE "@*HT3 \!\<Yes;\?\<Cancel" ;
  8547.       SIZE m.g_tdlgbtn,13.500,4.308 ;
  8548.       DEFAULT 1 ;
  8549.       FONT m.g_tdlgface, m.g_tdlgsize ;
  8550.       STYLE m.g_tdlgstyle
  8551.  
  8552. CASE _DOS OR _UNIX
  8553.    IF NOT WEXIST("tstructd")
  8554.       DEFINE WINDOW tstructd ;
  8555.          FROM INT((SROW()-7)/2),INT((SCOL()-47)/2) ;
  8556.          TO INT((SROW()-7)/2)+7,INT((SCOL()-47)/2)+46 ;
  8557.          FLOAT ;
  8558.          NOCLOSE ;
  8559.          SHADOW ;
  8560.          DOUBLE ;
  8561.          COLOR SCHEME 7
  8562.    ENDIF
  8563.  
  8564.    IF WVISIBLE("tstructd")
  8565.       ACTIVATE WINDOW tstructd SAME
  8566.    ELSE
  8567.       ACTIVATE WINDOW tstructd NOSHOW
  8568.    ENDIF
  8569.  
  8570.    * Format the file name for display
  8571.    m.msg = "File: "+m.g_scrndbf
  8572.    IF LEN(m.msg) > 44
  8573.       m.msg = m.g_scrndbf
  8574.       IF LEN(m.msg) > 44
  8575.          m.msg = justfname(m.g_scrndbf)
  8576.       ENDIF
  8577.    ENDIF
  8578.  
  8579.    @ 1,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  8580.    @ 2,(WCOLS()-LEN(m.textline))/2 SAY m.textline
  8581.    @ 4,2 GET m.choice ;
  8582.       PICTURE "@*HT "+T_YESNO_LOC ;
  8583.       SIZE 1,12,18 ;
  8584.       DEFAULT 1
  8585.  
  8586. OTHERWISE
  8587.    DO errorhandler WITH "Unknown Version.", LINENO(), c_error3
  8588.    RETURN .F.
  8589. ENDCASE
  8590.  
  8591. IF NOT WVISIBLE("tstructd")
  8592.    ACTIVATE WINDOW tstructd
  8593. ENDIF
  8594.  
  8595. READ CYCLE MODAL WHEN curpos()
  8596.  
  8597. RELEASE WINDOW tstructd
  8598.  
  8599. IF m.choice = 1
  8600.    RETURN .T.
  8601. ELSE
  8602.    RETURN .F.
  8603. ENDIF
  8604. RETURN
  8605.  
  8606. *!*****************************************************************************
  8607. *!
  8608. *!       Function: CURPOS
  8609. *!
  8610. *!      Called by: STRUCTDIALOG()     (function  in TRANSPRT.PRG)
  8611. *!
  8612. *!*****************************************************************************
  8613. FUNCTION curpos
  8614. IF _DOS OR _UNIX
  8615.    _CUROBJ = 2
  8616. ENDIF
  8617. RETURN .T.
  8618.  
  8619. **
  8620. ** Code Associated With Displaying the Screen Convert Dialog Box
  8621. **
  8622. *!*****************************************************************************
  8623. *!
  8624. *!       Function: SCXFRXDIALOG
  8625. *!
  8626. *!      Called by: CONVERTTYPE()      (function  in TRANSPRT.PRG)
  8627. *!
  8628. *!          Calls: HASRECORDS()       (function  in TRANSPRT.PRG)
  8629. *!               : STRIPPATH()        (function  in TRANSPRT.PRG)
  8630. *!               : SCRNCTRL()         (function  in TRANSPRT.PRG)
  8631. *!               : TRANSPRMPT()       (function  in TRANSPRT.PRG)
  8632. *!               : PVALID()           (function  in TRANSPRT.PRG)
  8633. *!               : ASKFONT()          (function  in TRANSPRT.PRG)
  8634. *!               : ERRORHANDLER       (procedure in TRANSPRT.PRG)
  8635. *!               : RDVALID()          (function  in TRANSPRT.PRG)
  8636. *!               : DEACCLAU()         (function  in TRANSPRT.PRG)
  8637. *!               : SHOWCLAU()         (function  in TRANSPRT.PRG)
  8638. *!
  8639. *!*****************************************************************************
  8640. FUNCTION scxfrxdialog
  8641. PARAMETER ftype
  8642. PRIVATE m.choice, m.fromplatform, m.dlgnum
  8643. m.choice = 0
  8644. m.gNShowMe = 1
  8645.  
  8646. DO CASE
  8647. CASE _WINDOWS
  8648.    IF m.ftype <> "LBX" AND hasrecords(c_winname)
  8649.       * No partial transport of labels
  8650.  
  8651.       m.fromplatform = dfltplat()
  8652.       m.dlgnum = 1
  8653.       m.g_allobjects = .F.
  8654.  
  8655.       * already contains some records for Windows
  8656.       DEFINE WINDOW transdlg ;
  8657.          AT  0.000, 0.000  ;
  8658.          SIZE 22.385,76.167 ;
  8659.          TITLE T_TITLE_LOC  ;
  8660.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8661.          STYLE m.g_tdlgsty1;
  8662.          FLOAT ;
  8663.          NOCLOSE ;
  8664.          NOMINIMIZE ;
  8665.          DOUBLE ;
  8666.          COLOR RGB(0,0,0,192,192,192)
  8667.       MOVE WINDOW transdlg CENTER
  8668.  
  8669.       IF WVISIBLE("transdlg")
  8670.          ACTIVATE WINDOW transdlg SAME
  8671.       ELSE
  8672.          ACTIVATE WINDOW transdlg NOSHOW
  8673.       ENDIF
  8674.  
  8675.       @ 14.077,1.667 TO 21.385,50.167 ;
  8676.          PEN 1, 8 ;
  8677.          STYLE "T"
  8678.       @ 13.615,2.667 SAY T_TRANSPORT_LOC  ;
  8679.          SIZE 1.000, 9.167, 0.000 ;
  8680.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8681.          STYLE m.g_tdlgsty1
  8682.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX",T_SCREEN_FILE_LOC,T_REPORT_FILE_LOC) ;
  8683.          SIZE 1.000,13.500, 0.000 ;
  8684.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8685.          STYLE m.g_tdlgstyle
  8686.       @ 1.000,16.667 SAY LOWER(strippath(m.cRealName)) ;
  8687.          SIZE 1.000,21.833 ;
  8688.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8689.          STYLE m.g_tdlgsty1
  8690.       @ 3.077,2.667 SAY T_OTHERPLAT_LOC+versioncap(m.g_toplatform)+"." ;
  8691.          SIZE 2.000,35.000, 0.000 ;
  8692.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8693.          STYLE m.g_tdlgsty1
  8694.       @ 8.077,2.667 SAY T_BYTRANS3_LOC+versioncap(m.g_toplatform)+T_BYTRANS4_LOC ;
  8695.          SIZE 2.000,48.167, 0.000 ;
  8696.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8697.          STYLE m.g_tdlgsty1
  8698.       @ 11.385,2.667 SAY T_TRANSOBJ_LOC +" " ;
  8699.          SIZE 1.000,23.500 ;
  8700.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8701.          STYLE m.g_tdlgsty1
  8702.       @ 5.615,2.667 SAY  T_NEWMOD1_LOC+versioncap(m.g_toplatform)+T_NEWMOD2_LOC+versioncap(m.g_toplatform)+T_NEWMOD3_LOC ;
  8703.          SIZE 2.000,47.833 ;
  8704.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8705.          STYLE m.g_tdlgsty1
  8706.       @ 17.846,7.500 SAY T_THAN_LOC    +versioncap(m.g_toplatform)+T_EQIVOBJS_LOC ;
  8707.          SIZE 1.000,32.667 ;
  8708.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8709.          STYLE m.g_tdlgsty1
  8710.       m.thepict = "@^ "+makepict(c_dosnum,c_macnum,c_unixnum, @m.fromplatform)
  8711.       @ 11.231,25.833 GET m.fromplatform ;
  8712.          PICTURE m.thepict ;
  8713.          SIZE 1.538,24.333 ;
  8714.          DEFAULT 1 ;
  8715.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8716.          STYLE m.g_tdlgsty1
  8717.       @ 14.923,4.500 GET m.g_newobjects ;
  8718.          PICTURE "@*C "+T_OBJSNEWTO_LOC+versioncap(m.g_toplatform) ;
  8719.          SIZE 1.308,28.167 ;
  8720.          DEFAULT .T. ;
  8721.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8722.          STYLE m.g_tdlgsty1 ;
  8723.          VALID scrnctrl() ;
  8724.          COLOR ,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,,RGB(0,0,0,192,192,192),RGB(128,128,128,192,192,192)
  8725.       @ 16.538,4.500 GET m.g_snippets ;
  8726.          PICTURE "@*C"+T_RECMOD_LOC ;
  8727.          SIZE 1.308,34.667 ;
  8728.          DEFAULT .T. ;
  8729.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8730.          STYLE m.g_tdlgsty1 ;
  8731.          VALID scrnctrl() ;
  8732.          COLOR ,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,,RGB(0,0,0,192,192,192),RGB(128,128,128,192,192,192)
  8733.       @ 19.385,4.500 GET m.g_allobjects ;
  8734.          PICTURE "@*C "+T_REPLOBJ_LOC ;
  8735.          SIZE 1.308,43.833 ;
  8736.          DEFAULT .F. ;
  8737.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8738.          STYLE m.g_tdlgsty1 ;
  8739.          VALID scrnctrl() ;
  8740.          COLOR ,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,,RGB(0,0,0,192,192,192),RGB(128,128,128,192,192,192)
  8741.       @ 0.615,51.667 GET m.choice ;
  8742.          PICTURE "@*VNT "+transprmpt()+";"+T_CONVASIS_LOC ;
  8743.          SIZE 1.769,23.000,0.308 ;
  8744.          DEFAULT 1 ;
  8745.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8746.          STYLE m.g_tdlgsty1 ;
  8747.          VALID pvalid()
  8748.       @ 13.077,51.667 GET m.g_askfont ;
  8749.          PICTURE "@*VN "+T_FONT1_LOC ;
  8750.          SIZE 1.769,23.000,0.308 ;
  8751.          DEFAULT 1 ;
  8752.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8753.          STYLE m.g_tdlgsty1 ;
  8754.          VALID askfont()
  8755.  
  8756.        *- stop from showing this dialog? (2/28/95 jd)
  8757.        IF m.lPJX
  8758.            @ 16.385,51.667 GET m.gNShowMe ;
  8759.                 PICTURE "@*RV " + C_ASK1_LOC + SUBS("PJXSCXFRX",((m.g_tpFileIndx - 1) * 3) + 1,3) + C_ASK2_LOC;
  8760.                 DEFAULT 1 ;
  8761.                 FONT m.g_tdlgface, m.g_tdlgsize ;
  8762.                 STYLE m.g_tdlgsty1 ;
  8763.                 COLOR ,,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192)
  8764.         ENDIF
  8765.  
  8766.    ELSE    && no existing WINDOWS records
  8767.       m.fromplatform = dfltplat()
  8768.       m.dlgnum = 2
  8769.       DEFINE WINDOW transdlg ;
  8770.          AT 0.000, 0.000 ;
  8771.          SIZE 15.077,66.167 ;
  8772.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8773.          STYLE m.g_tdlgsty1 ;
  8774.          TITLE T_TITLE_LOC ;
  8775.          FLOAT ;
  8776.          NOCLOSE ;
  8777.          NOMINIMIZE ;
  8778.          DOUBLE ;
  8779.          COLOR RGB(0,0,0,192,192,192)
  8780.       MOVE WINDOW transdlg CENTER
  8781.  
  8782.       IF WVISIBLE("transdlg")
  8783.          ACTIVATE WINDOW transdlg SAME
  8784.       ELSE
  8785.          ACTIVATE WINDOW transdlg NOSHOW
  8786.       ENDIF
  8787.  
  8788.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX",T_SCREEN_FILE_LOC ,;
  8789.          IIF(m.ftype = "FRX",T_REPORT_FILE_LOC,T_LABEL_FILE_LOC)) ;
  8790.          SIZE 1.000,11.500, 0.000 ;
  8791.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8792.          STYLE m.g_tdlgstyle
  8793.       @ 1.000,14.667 SAY LOWER(strippath(m.cRealName)) ;
  8794.          SIZE 1.000,21.833 ;
  8795.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8796.          STYLE m.g_tdlgsty1
  8797.       @ 3.077,2.667 SAY T_OTHERPLAT_LOC+versioncap(m.g_toplatform)+"." ;
  8798.          SIZE 2.000,35.000, 0.000 ;
  8799.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8800.          STYLE m.g_tdlgstyle
  8801.       @ 5.923,2.667 SAY T_BYTRANS1_LOC + CHR(13) + ;
  8802.          versioncap(m.g_toplatform)+T_BYTRANS2_LOC  + ;
  8803.          T_NOCONV_LOC  ;
  8804.          SIZE 4.000,36.833, 0.000 ;
  8805.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8806.          STYLE m.g_tdlgstyle
  8807.       @ 10.923,2.667 SAY T_TRANSOBJ_LOC +" " ;
  8808.          SIZE 1.000,23.500, 0.000 ;
  8809.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8810.          STYLE m.g_tdlgsty1
  8811.       m.thepict = "@^ "+makepict(c_dosnum,c_macnum,c_unixnum, @m.fromplatform)
  8812.       @ 12.154,2.667 GET m.fromplatform ;
  8813.          PICTURE m.thepict ;
  8814.          SIZE 1.538,24.333 ;
  8815.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8816.          STYLE m.g_tdlgsty1
  8817.       @ 6.846,40.833 GET m.g_askfont ;
  8818.          PICTURE "@*VN "+T_FONT1_LOC  ;
  8819.          SIZE 1.769,23.000,0.308 ;
  8820.          DEFAULT 1 ;
  8821.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8822.          STYLE m.g_tdlgsty1 ;
  8823.          VALID askfont()
  8824.       @ 0.615,40.833 GET m.choice ;
  8825.          PICTURE "@*VNT "+transprmpt()+";"+T_NOTRANSPORT_LOC ;
  8826.          SIZE 1.769,23.000,0.308 ;
  8827.          DEFAULT 1 ;
  8828.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8829.          STYLE m.g_tdlgsty1 ;
  8830.          VALID pvalid()
  8831.  
  8832.         IF m.lPJX
  8833.            *- stop from showing this dialog?
  8834.            @ 11.154,40.833 GET m.gNShowMe ;
  8835.                 PICTURE "@*RV " + C_ASK1_LOC + SUBS("PJXSCXFRX",((m.g_tpFileIndx - 1) * 3) + 1,3) + C_ASK2_LOC;
  8836.                 DEFAULT 1 ;
  8837.                 FONT m.g_tdlgface, m.g_tdlgsize ;
  8838.                 STYLE m.g_tdlgsty1 ;
  8839.                 COLOR ,,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192)
  8840.         ENDIF
  8841.  
  8842.    ENDIF
  8843.  
  8844. CASE  _MAC
  8845.    LOCAL iFormWidth
  8846.  
  8847.    iFormWidth = IIF(m.lPJX,68.500, 58)
  8848.    iFormHeight = IIF(m.lPJX,21.600, 13.077)
  8849.  
  8850.    IF m.ftype <> "LBX" AND hasrecords(c_macname)
  8851.       * No partial transport of labels
  8852.  
  8853.       m.fromplatform = dfltplat()
  8854.       m.dlgnum = 1
  8855.       m.g_allobjects = .F.
  8856.  
  8857.       * already contains some Mac records
  8858.       DEFINE WINDOW transdlg ;
  8859.          AT  0.000, 0.000  ;
  8860.          SIZE iFormHeight,iFormWidth ;
  8861.          TITLE T_TITLE_LOC  ;
  8862.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8863.          STYLE m.g_tdlgsty1;
  8864.          FLOAT ;
  8865.          CLOSE ;
  8866.          NOMINIMIZE ;
  8867.          DOUBLE ;
  8868.          COLOR RGB(0, 0, 0,192,192,192)
  8869.       MOVE WINDOW transdlg CENTER
  8870.  
  8871.       IF WVISIBLE("transdlg")
  8872.          ACTIVATE WINDOW transdlg SAME
  8873.       ELSE
  8874.          ACTIVATE WINDOW transdlg NOSHOW
  8875.       ENDIF
  8876.  
  8877.       @ 12.077,1.667 TO 19.385,46.0 ;
  8878.          PEN 1, 8 ;
  8879.          STYLE "T"
  8880.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX",T_SCREEN_FILE_LOC ,T_REPORT_FILE_LOC) ;
  8881.          SIZE 1.000,13.500, 0.000 ;
  8882.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8883.          STYLE m.g_tdlgstyle
  8884.       @ 1.000,16.667 SAY LOWER(strippath(m.cRealName)) ;
  8885.          SIZE 1.000,21.833 ;
  8886.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8887.          STYLE m.g_tdlgsty1
  8888.       @ 0.615,49.000 GET m.choice ;
  8889.          PICTURE "@*VNTM "+transprmpt()+";"+T_OPENASIS_LOC ;
  8890.          SIZE m.g_tdlgbtn,12.000,0.500 ;
  8891.          DEFAULT 1 ;
  8892.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8893.          STYLE m.g_tdlgsty1 ;
  8894.          VALID pvalid()
  8895.       @ 12.077,49 GET m.g_askfont ;
  8896.          PICTURE "@*VNM "+T_FONT1_LOC  ;
  8897.          SIZE m.g_tdlgbtn,12.000,0.308 ;
  8898.          DEFAULT 1 ;
  8899.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8900.          STYLE m.g_tdlgsty1 ;
  8901.          VALID askfont()
  8902.         IF m.ftype = "SCX"
  8903.             @ 15.000, 48 GET m.g_look2d ;
  8904.                PICTURE "@*C3 " + C_2DCONTROLS_LOC ;
  8905.                 DEFAULT 0 ;
  8906.              FONT m.g_tdlgface, m.g_tdlgsize ;
  8907.              STYLE m.g_tdlgstyle ;
  8908.                 VALID setctrl()
  8909.        ENDIF
  8910.       @ 3.077,2.667 SAY T_OTHERPLAT_LOC+versioncap(m.g_toplatform)+"." ;
  8911.          SIZE 2.000,50.000, 0.000 ;
  8912.          FONT m.g_smface, m.g_smsize ;
  8913.          STYLE m.g_smsty1
  8914.       @ 5.615,2.667 SAY T_NEWMOD1_LOC+versioncap(m.g_toplatform)+T_NEWMOD2_LOC+versioncap(m.g_toplatform)+T_NEWMOD3_LOC ;
  8915.          SIZE 2.000,60.000 ;
  8916.          FONT m.g_smface, m.g_smsize ;
  8917.          STYLE m.g_smsty1
  8918.       @ 8.077,2.667 SAY T_BYTRANS3_LOC +versioncap(m.g_toplatform)+T_BYTRANS4_LOC ;
  8919.          SIZE 2.000,60.000, 0.000 ;
  8920.          FONT m.g_smface, m.g_smsize ;
  8921.          STYLE m.g_smsty1
  8922.       @ 10.385,2.667 SAY T_TRANSOBJ_LOC +" " ;
  8923.          SIZE 1.000,28.000 ;
  8924.          FONT m.g_smface, m.g_smsize ;
  8925.          STYLE m.g_smsty1
  8926.       m.thepict = "@^3 "+makepict(c_winnum, c_dosnum, c_unixnum, @m.fromplatform)
  8927.       @ 10.231,21.833 GET m.fromplatform ;
  8928.          PICTURE m.thepict ;
  8929.          SIZE 1.538,24.333 ;
  8930.          DEFAULT 1 ;
  8931.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8932.          STYLE m.g_tdlgsty1
  8933.       @ 11.615,2.667 SAY T_TRANSPORT_LOC  ;
  8934.          SIZE 1.000, 9.167, 0.000 ;
  8935.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8936.          STYLE m.g_tdlgsty1
  8937.       @ 12.923,4.500 GET m.g_newobjects ;
  8938.          PICTURE "@*C3 "+T_OBJSNEWTO_LOC+versioncap(m.g_toplatform) ;
  8939.          SIZE 1.308,28.167 ;
  8940.          DEFAULT .T. ;
  8941.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8942.          STYLE m.g_tdlgstyle ;
  8943.          VALID scrnctrl()
  8944.       @ 14.538,4.500 GET m.g_snippets ;
  8945.          PICTURE "@*C3"+T_RECMOD_LOC ;
  8946.          SIZE 1.308,34.667 ;
  8947.          DEFAULT .T. ;
  8948.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8949.          STYLE m.g_tdlgstyle ;
  8950.          VALID scrnctrl()
  8951.       @ 15.846,7.500 SAY T_THAN_LOC+versioncap(m.g_toplatform)+T_EQIVOBJS_LOC ;
  8952.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8953.          SIZE 1.000,30.000 ;
  8954.          STYLE m.g_tdlgstyle  && 
  8955.  
  8956.       @ 17.385,4.500 GET m.g_allobjects ;
  8957.          PICTURE "@*C3 "+T_REPLOBJ_LOC ;
  8958.          SIZE 1.308,43.833 ;
  8959.          DEFAULT .F. ;
  8960.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8961.          STYLE m.g_tdlgstyle ;
  8962.          VALID scrnctrl()
  8963.  
  8964.        *- stop from showing this dialog? (11/1/95 jd)
  8965.        IF m.lPJX
  8966.            @ 16.385,47 GET m.gNShowMe ;
  8967.                 PICTURE "@*RV " + C_ASK1_LOC + SUBS("PJXSCXFRX",((m.g_tpFileIndx - 1) * 3) + 1,3) + C_ASK2_LOC;
  8968.                 DEFAULT 1 ;
  8969.                 FONT m.g_tdlgface, m.g_tdlgsize ;
  8970.                 STYLE m.g_tdlgsty1 ;
  8971.                 COLOR ,,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192)
  8972.         ENDIF
  8973.  
  8974.    ELSE    && no existing MAC records
  8975.  
  8976.       m.fromplatform = dfltplat()
  8977.       m.dlgnum = 2
  8978.       DEFINE WINDOW transdlg ;
  8979.          AT 0.000, 0.000 ;
  8980.          SIZE iFormHeight,iFormWidth ;
  8981.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8982.          STYLE m.g_tdlgsty1 ;
  8983.          TITLE T_TITLE_LOC  ;
  8984.          FLOAT ;
  8985.          CLOSE ;
  8986.          NOMINIMIZE ;
  8987.          DOUBLE ;
  8988.          COLOR RGB(0, 0, 0, 192, 192, 192)
  8989.       MOVE WINDOW transdlg CENTER
  8990.  
  8991.       IF WVISIBLE("transdlg")
  8992.          ACTIVATE WINDOW transdlg SAME
  8993.       ELSE
  8994.          ACTIVATE WINDOW transdlg NOSHOW
  8995.       ENDIF
  8996.  
  8997.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX",T_SCREEN_FILE_LOC ,;
  8998.          IIF(m.ftype = "FRX",T_REPORT_FILE_LOC,T_LABEL_FILE_LOC)) ;
  8999.          SIZE 1.000,11.500, 0.000 ;
  9000.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9001.          STYLE m.g_tdlgstyle
  9002.       @ 1.000,14.667 SAY LOWER(strippath(m.cRealName)) ;
  9003.          SIZE 1.000,22.000 ;
  9004.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9005.          STYLE m.g_tdlgsty1
  9006.       @ 3.077,2.667 SAY T_OTHERPLAT_LOC+versioncap(m.g_toplatform)+"." ;
  9007.          SIZE 2,45,0 ;
  9008.          FONT m.g_smface, m.g_smsize ;
  9009.          STYLE m.g_smstyle
  9010.       @ 5.923,2.667 SAY T_BYTRANS1_LOC + CHR(13)  ;
  9011.          + versioncap(m.g_toplatform)+T_BYTRANS2_LOC ;
  9012.          SIZE 2,45,0 ;
  9013.          FONT m.g_smface, m.g_smsize ;
  9014.          STYLE m.g_smstyle
  9015.       @ 8.923,2.667 SAY T_TRANSOBJ_LOC  ;
  9016.          SIZE 1.000, 28.000, 0.000 ;
  9017.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9018.          STYLE m.g_tdlgsty2
  9019.       @ 0.615,42.833 GET m.choice ;
  9020.          PICTURE "@*VNTM "+transprmpt()+";\?"+T_CANCEL_LOC;
  9021.          SIZE m.g_tdlgbtn,12.000,1.000 ;
  9022.          DEFAULT 1 ;
  9023.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9024.          STYLE m.g_tdlgsty1 ;
  9025.          VALID pvalid()
  9026.       @ 6.846,42.833 GET m.g_askfont ;
  9027.          PICTURE "@*VNM "+T_FONT1_LOC  ;
  9028.          SIZE m.g_tdlgbtn,12.000,0.308 ;
  9029.          DEFAULT 1 ;
  9030.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9031.          STYLE m.g_tdlgsty1 ;
  9032.          VALID askfont()
  9033.         IF m.ftype = "SCX"
  9034.             @ 8.800, 40.833 GET m.g_look2d ;
  9035.                PICTURE "@*C3 " + C_2DCONTROLS_LOC;
  9036.                 DEFAULT 0 ;
  9037.              FONT m.g_tdlgface, m.g_tdlgsize ;
  9038.              STYLE m.g_tdlgstyle ;
  9039.                 VALID setctrl()
  9040.         ENDIF
  9041.       m.thepict = "@^3 "+makepict(c_winnum, c_dosnum, c_unixnum, @m.fromplatform)
  9042.       @ 10.154,2.667 GET m.fromplatform ;
  9043.          PICTURE m.thepict ;
  9044.          SIZE 1.538,24.333 ;
  9045.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9046.          STYLE m.g_tdlgsty1
  9047.  
  9048.         IF m.lPJX
  9049.            *- stop from showing this dialog?
  9050.            @ 11.154,40.833 GET m.gNShowMe ;
  9051.                 PICTURE "@*RV " + C_ASK1_LOC + SUBS("PJXSCXFRX",((m.g_tpFileIndx - 1) * 3) + 1,3) + C_ASK2_LOC;
  9052.                 DEFAULT 1 ;
  9053.                 FONT m.g_tdlgface, m.g_tdlgsize ;
  9054.                 STYLE m.g_tdlgsty1 ;
  9055.                 COLOR ,,,,,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192),,RGB(0,0,0,192,192,192),RGB(0,0,0,192,192,192)
  9056.         ENDIF
  9057.    ENDIF
  9058. CASE _DOS OR _UNIX
  9059.    m.fromplatform = c_foxwin_loc
  9060.    IF m.ftype <> "LBX" AND (hasrecords(c_dosname) OR hasrecords(c_unixname))
  9061.       m.dlgnum = 1
  9062.       m.g_allobjects = .F.
  9063.  
  9064.       DEFINE WINDOW transdlg ;
  9065.          FROM INT((SROW()-21)/2),INT((SCOL()-67)/2) ;
  9066.          TO INT((SROW()-21)/2)+20,INT((SCOL()-67)/2)+66 ;
  9067.          FLOAT ;
  9068.          CLOSE ;
  9069.          SHADOW ;
  9070.          NOMINIMIZE ;
  9071.          DOUBLE ;
  9072.          COLOR SCHEME 5
  9073.  
  9074.       IF WVISIBLE("transdlg")
  9075.          ACTIVATE WINDOW transdlg SAME
  9076.       ELSE
  9077.          ACTIVATE WINDOW transdlg NOSHOW
  9078.       ENDIF
  9079.  
  9080.       @ 11,2 TO 16,52
  9081.       @ 1,2 SAY IIF(m.g_filetype = c_screen,T_SCREEN_FILE_LOC ,T_REPORT_FILE_LOC) ;
  9082.          SIZE 1,12, 0
  9083.       @ 1,15 SAY UPPER(strippath(m.cRealName)) ;
  9084.          SIZE 1,19
  9085.       @ 3,2 SAY T_OTHERPLAT2_LOC ;
  9086.          SIZE 1,38, 0
  9087.       @ 4,2 SAY T_OTHERPLAT3_LOC ;
  9088.          SIZE 1,33, 0
  9089.       @ 9,4 SAY T_TRANSOBJ_LOC  ;
  9090.          SIZE 1,23, 0
  9091.       m.thepict = "@^ "+makepict(c_winnum, c_macnum, c_unixnum, @m.fromplatform)
  9092.       @ 8,29 GET m.fromplatform ;
  9093.          PICTURE m.thepict ;
  9094.          SIZE 3,24 ;
  9095.          COLOR SCHEME 5, 6
  9096.       @ 1,45 GET m.choice ;
  9097.          PICTURE "@*VNT "+T_TRANSOPEN_LOC  ;
  9098.          SIZE 1,20,1 ;
  9099.          DEFAULT 1 ;
  9100.          VALID pvalid()
  9101.       @ 11,4 SAY T_TRANSPORT_LOC  ;
  9102.          SIZE 1,9, 0
  9103.       @ 12,4 GET m.g_newobjects ;
  9104.          PICTURE "@*C "+T_OBJSNEWTO_LOC+versioncap(m.g_toplatform) ;
  9105.          SIZE 1,25 ;
  9106.          DEFAULT .T. ;
  9107.          VALID scrnctrl()
  9108.       @ 13,4 GET m.g_snippets ;
  9109.          PICTURE "@*C"+T_RECMOD_LOC ;
  9110.          SIZE 1,34 ;
  9111.          DEFAULT .T. ;
  9112.          VALID scrnctrl()
  9113.       @ 14,8 SAY T_THAN_LOC + versioncap(m.g_toplatform) + T_EQIVOBJS_LOC;
  9114.          SIZE 1,30, 0
  9115.       @ 15,4 GET m.g_allobjects ;
  9116.          PICTURE "@*C "+T_REPLOBJ_LOC ;
  9117.          SIZE 1,47 ;
  9118.          DEFAULT .F. ;
  9119.          VALID scrnctrl()
  9120.       @ 7,2 SAY T_OBJINFILE_LOC  ;
  9121.          SIZE 1,24, 0
  9122.       @ 5,2 SAY T_BYTRANS5_LOC   ;
  9123.          SIZE 1,35, 0
  9124.       @ 6,2 SAY T_BYTRANS6_LOC ;
  9125.          SIZE 1,37, 0
  9126.  
  9127.       IF NOT WVISIBLE("transdlg")
  9128.          ACTIVATE WINDOW transdlg
  9129.       ENDIF
  9130.    ELSE
  9131.       m.dlgnum = 2
  9132.  
  9133.       DEFINE WINDOW transdlg ;
  9134.          FROM INT((SROW()-15)/2),INT((SCOL()-68)/2) ;
  9135.          TO INT((SROW()-15)/2)+14,INT((SCOL()-68)/2)+67 ;
  9136.          FLOAT ;
  9137.          NOCLOSE ;
  9138.          SHADOW ;
  9139.          NOMINIMIZE ;
  9140.          DOUBLE ;
  9141.          COLOR SCHEME 5
  9142.  
  9143.       IF WVISIBLE("transdlg")
  9144.          ACTIVATE WINDOW transdlg SAME
  9145.       ELSE
  9146.          ACTIVATE WINDOW transdlg NOSHOW
  9147.       ENDIF
  9148.  
  9149.       @ 1,2 SAY IIF(m.g_filetype = c_screen,T_SCREEN_FILE_LOC ,T_REPORT_FILE_LOC) ;
  9150.          SIZE 1,12, 0
  9151.       @ 1,15 SAY UPPER(strippath(m.cRealName)) ;
  9152.          SIZE 1,19
  9153.       @ 3,2 SAY T_OTHERPLAT2_LOC ;
  9154.          SIZE 1,38, 0
  9155.       @ 4,2 SAY T_OTHERPLAT3_LOC ;
  9156.          SIZE 1,33, 0
  9157.       @ 8,4 SAY T_TRANSOBJ_LOC  ;
  9158.          SIZE 1,23, 0
  9159.       m.thepict = "@^ "+makepict(c_winnum, c_macnum, c_unixnum, @m.fromplatform)
  9160.       @ 9,4 GET m.fromplatform ;
  9161.          PICTURE m.thepict ;
  9162.          SIZE 3,24 ;
  9163.          COLOR SCHEME 5, 6
  9164.       @ 1,45 GET m.choice ;
  9165.          PICTURE "@*VNT "+T_TRANSOPEN1_LOC ;
  9166.          SIZE 1,20,1 ;
  9167.          DEFAULT 1 ;
  9168.          VALID pvalid()
  9169.       @ 5,2 SAY T_BYTRANS1_LOC ;
  9170.          SIZE 1,37, 0
  9171.       @ 6,2 SAY "MS-DOS" + T_BYTRANS2_LOC ;
  9172.          SIZE 1,37, 0
  9173.  
  9174.       IF NOT WVISIBLE("transdlg")
  9175.          ACTIVATE WINDOW transdlg
  9176.       ENDIF
  9177.    ENDIF
  9178. OTHERWISE
  9179.    DO errorhandler WITH T_UNKNOWNVERS_LOC, LINENO(), c_error3
  9180.    RETURN .F.
  9181. ENDCASE
  9182.  
  9183. * The effect of this code is to skip the read entirely if gAShowMe[filetype,1] is
  9184. * FALSE. All of the variables in this dialog are set to their default
  9185. * values, the dialog isn't displayed, the warning about overwriting
  9186. * existing records isn't displayed, and processing continues.
  9187. IF m.gAShowMe[m.g_tpFileIndx,1]
  9188.    IF NOT WVISIBLE("transdlg")
  9189.       ACTIVATE WINDOW transdlg
  9190.    ENDIF
  9191.     *- this do loop is here to work around bug in VFP Mac
  9192.     DO WHILE m.choice == 0
  9193.        READ CYCLE MODAL ;
  9194.           VALID rdvalid(m.dlgnum) ;
  9195.           DEACTIVATE deacclau() ;
  9196.           SHOW showclau() ;
  9197.           SAVE                        && BUGBUG remove SAVE option after bug is fixed!
  9198.     ENDDO
  9199. ELSE
  9200.    CLEAR GETS
  9201.    m.choice = m.gAShowMe[m.g_tpFileIndx,2]    && pretend user said whatever they said before
  9202.    IF !EMPTY(m.gAShowMe[m.g_tpFileIndx,3])
  9203.        *- a font has been specified
  9204.        m.g_fontset = .T.
  9205.        m.g_dfltfface   =  m.gAShowMe[m.g_tpFileIndx,3]
  9206.        m.g_dfltfsize   =  m.gAShowMe[m.g_tpFileIndx,4]
  9207.        m.g_dfltfstyle  =  m.gAShowMe[m.g_tpFileIndx,5]
  9208.    ENDIF
  9209.    IF !EMPTY(m.gAShowMe[m.g_tpFileIndx,6])
  9210.        m.fromplatform = m.gAShowMe[m.g_tpFileIndx,6]
  9211.    ENDIF
  9212.     m.g_newobjects = gAShowMe[m.g_tpFileIndx,7]                                && convert new objects
  9213.     m.g_snippets = gAShowMe[m.g_tpFileIndx,8]                                && convert more recently modified objects
  9214.     m.g_allobjects  = gAShowMe[m.g_tpFileIndx,9]                            && replace all objects -- changed from [IIF(!g_allobjects,.F.,gAShowMe[m.g_tpFileIndx,9])] bug? (jd 04/16/96)
  9215.     =pvalid()                                                                && make sure this gets executed
  9216. ENDIF
  9217.  
  9218. RELEASE WINDOW transdlg
  9219.  
  9220. *
  9221. * We could simply return m.choice, but this way we can mess with the dialog without changing
  9222. * the defines.
  9223. *
  9224. IF gAShowMe[m.g_tpFileIndx,1]
  9225.     DO CASE
  9226.     CASE m.choice = 1
  9227.        *- handle radio button choice
  9228.        DO CASE
  9229.         CASE m.gNShowMe = 1
  9230.             *- continue to ask
  9231.             gAShowMe[m.g_tpFileIndx,1] = .T.
  9232.             gAShowMe[m.g_tpFileIndx,2] = m.choice
  9233.         CASE m.gNShowMe = 2
  9234.             *- don't ask for this file type
  9235.             gAShowMe[m.g_tpFileIndx,1] = .F.
  9236.             gAShowMe[m.g_tpFileIndx,2] = m.choice
  9237.             gAShowMe[m.g_tpFileIndx,6] = m.fromplatform
  9238.             gAShowMe[m.g_tpFileIndx,7] = m.g_newobjects                    && convert new objects
  9239.             gAShowMe[m.g_tpFileIndx,8] = m.g_snippets                    && convert more recently modified objects
  9240.             gAShowMe[m.g_tpFileIndx,9] = m.g_allobjects                    && replace all objects
  9241.         CASE m.gNShowMe = 3
  9242.             *- don't ask for any file type
  9243.             LOCAL ictr
  9244.             FOR ictr = 1 TO ALEN(gAShowMe,1)
  9245.                 gAShowMe[ictr,1] = .F.
  9246.                 gAShowMe[ictr,2] = m.choice
  9247.                 gAShowMe[ictr,6] = m.fromplatform                && changed from [gAShowMe[m.g_tpFileIndx,6] = m.fromplatform] (looked like bug 04/16/96 jd)
  9248.                 gAShowMe[ictr,7] = m.g_newobjects                && convert new objects
  9249.                 gAShowMe[ictr,8] = m.g_snippets                    && convert more recently modified objects
  9250.                 gAShowMe[ictr,9] = m.g_allobjects                && replace all objects
  9251.             NEXT
  9252.        ENDCASE
  9253.        RETURN c_yes
  9254.     CASE m.choice = 2 AND m.dlgnum = 1
  9255.        DO CASE
  9256.         CASE m.gNShowMe = 1
  9257.             *- continue to ask
  9258.             gAShowMe[m.g_tpFileIndx,1] = .T.
  9259.             gAShowMe[m.g_tpFileIndx,2] = m.choice
  9260.         CASE m.gNShowMe = 2
  9261.             *- don't ask for this file type
  9262.             gAShowMe[m.g_tpFileIndx,1] = .F.
  9263.             gAShowMe[m.g_tpFileIndx,2] = m.choice
  9264.             gAShowMe[m.g_tpFileIndx,6] = m.fromplatform
  9265.             gAShowMe[m.g_tpFileIndx,7] = m.g_newobjects                    && convert new objects
  9266.             gAShowMe[m.g_tpFileIndx,8] = m.g_snippets                    && convert more recently modified objects
  9267.             gAShowMe[m.g_tpFileIndx,9] = m.g_allobjects                    && replace all objects
  9268.         CASE m.gNShowMe = 3
  9269.             *- don't ask for any file type
  9270.             LOCAL ictr
  9271.             FOR ictr = 1 TO ALEN(gAShowMe,1)
  9272.                 gAShowMe[ictr,1] = .F.
  9273.                 gAShowMe[ictr,2] = m.choice
  9274.                 gAShowMe[ictr,6] = m.fromplatform
  9275.                 gAShowMe[ictr,7] = m.g_newobjects                    && convert new objects
  9276.                 gAShowMe[ictr,8] = m.g_snippets                        && convert more recently modified objects
  9277.                 gAShowMe[ictr,9] = m.g_allobjects                    && replace all objects
  9278.             NEXT
  9279.        ENDCASE
  9280.        RETURN c_no
  9281.     OTHERWISE
  9282.        DO CASE
  9283.         CASE m.gNShowMe = 1
  9284.             *- continue to ask
  9285.             gAShowMe[m.g_tpFileIndx,1] = .T.
  9286.             gAShowMe[m.g_tpFileIndx,2] = 2
  9287.         CASE m.gNShowMe = 2
  9288.             *- don't ask for this file type
  9289.             gAShowMe[m.g_tpFileIndx,1] = .F.
  9290.             gAShowMe[m.g_tpFileIndx,2] = 2
  9291.             gAShowMe[m.g_tpFileIndx,7] = m.g_newobjects                    && convert new objects
  9292.             gAShowMe[m.g_tpFileIndx,8] = m.g_snippets                    && convert more recently modified objects
  9293.             gAShowMe[m.g_tpFileIndx,9] = m.g_allobjects                    && replace all objects
  9294.         CASE m.gNShowMe = 3
  9295.             *- don't ask for any file type
  9296.             LOCAL ictr
  9297.             FOR ictr = 1 TO ALEN(gAShowMe,1)
  9298.                 gAShowMe[ictr,1] = .F.
  9299.                 gAShowMe[ictr,2] = 2
  9300.                 gAShowMe[ictr,7] = m.g_newobjects                    && convert new objects
  9301.                 gAShowMe[ictr,8] = m.g_snippets                    && convert more recently modified objects
  9302.                 gAShowMe[ictr,9] = m.g_allobjects                    && replace all objects
  9303.             NEXT
  9304.        ENDCASE
  9305.        RETURN c_cancel
  9306.     ENDCASE
  9307. ELSE
  9308.     DO CASE
  9309.         CASE gAShowMe[g_tpFileIndx,2] = 1
  9310.             RETURN c_yes
  9311.         CASE gAShowMe[g_tpFileIndx,2] = 2 AND m.dlgnum = 1
  9312.             RETURN c_no
  9313.         OTHERWISE
  9314.             RETURN c_cancel
  9315.     ENDCASE
  9316. ENDIF
  9317. RETURN
  9318.  
  9319. *!*****************************************************************************
  9320. *!
  9321. *!       Function: dfltplat
  9322. *!
  9323. *!*****************************************************************************
  9324. FUNCTION dfltplat
  9325. * Return the default platform to transport from
  9326. PRIVATE m.plat
  9327. DO CASE
  9328. CASE hasrecords(c_winname) AND !_WINDOWS
  9329.    m.plat =   c_foxwin_loc
  9330. CASE hasrecords(c_macname) AND !_MAC
  9331.    m.plat =   c_foxmac_loc
  9332. CASE hasrecords(c_dosname) AND !_DOS
  9333.    m.plat =   c_foxdos_loc
  9334. OTHERWISE
  9335.    m.plat =   c_foxwin_loc
  9336. ENDCASE
  9337. RETURN m.plat
  9338.  
  9339. *!*****************************************************************************
  9340. *!
  9341. *!       Function: MAKEPICT
  9342. *!
  9343. *!*****************************************************************************
  9344. FUNCTION makepict
  9345. * Assemble picture clause for "from" platform popup.  This routine creates
  9346. * the popup entries and enables or disables them based on whether the
  9347. * candidate platform has any records in the screen/report file.
  9348. PARAMETER a,b,c, dfltitem
  9349. PRIVATE m.i, m.pictstrg
  9350. DECLARE a_plats[3]
  9351. a_plats[1] = m.a
  9352. a_plats[2] = m.b
  9353. a_plats[3] = m.c
  9354. m.pictstrg = ""
  9355.  
  9356. m.looptop = 3
  9357. m.found_dflt = .F.
  9358.  
  9359. FOR m.i = 1 TO m.looptop
  9360.    DO CASE
  9361.    CASE a_plats[m.i] = c_dosnum
  9362.         DO CASE
  9363.         CASE !hasrecords(c_dosname)
  9364.           m.pictstrg = m.pictstrg + "\"
  9365.         CASE !m.found_dflt
  9366.             m.dfltitem = c_foxdos_loc
  9367.             m.found_dflt = .T.
  9368.         ENDCASE
  9369.          m.pictstrg = m.pictstrg + c_foxdos_loc
  9370.    CASE a_plats[m.i] = c_winnum
  9371.         DO CASE
  9372.         CASE !hasrecords(c_winname)
  9373.           m.pictstrg = m.pictstrg + "\"
  9374.         CASE !m.found_dflt
  9375.             m.dfltitem = c_foxwin_loc
  9376.             m.found_dflt = .T.
  9377.         ENDCASE
  9378.          m.pictstrg = m.pictstrg + c_foxwin_loc
  9379.  
  9380.    CASE a_plats[m.i] = c_macnum
  9381.         DO CASE
  9382.         CASE !hasrecords(c_macname)
  9383.           m.pictstrg = m.pictstrg + "\"
  9384.         CASE !m.found_dflt
  9385.             m.dfltitem = c_foxmac_loc
  9386.             m.found_dflt = .T.
  9387.         ENDCASE
  9388.          m.pictstrg = m.pictstrg + c_foxmac_loc
  9389.    ENDCASE
  9390.    m.pictstrg = m.pictstrg + iif(m.i < m.looptop,";","")
  9391. ENDFOR
  9392. RETURN m.pictstrg
  9393.  
  9394. *
  9395. * TRANSPRMPT - Determine the prompt for the transport button
  9396. *
  9397. *!*****************************************************************************
  9398. *!
  9399. *!       Function: TRANSPRMPT
  9400. *!
  9401. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9402. *!
  9403. *!*****************************************************************************
  9404. FUNCTION transprmpt
  9405. HOUR = LEFT(TIME(),2)
  9406. DO CASE
  9407. CASE _MAC
  9408.    RETURN "\!"+T_TRANSPORT_LOC 
  9409. CASE (DOW(DATE()) = 7 AND HOUR >= "23" AND HOUR < "24") OR ATC(T_ENERGIZE_LOC,GETENV("TRANSPRT")) > 0
  9410.    * Debts must be paid
  9411.    g_energize = .T.
  9412.    RETURN T_ENERGIZE_LOC       && Beam me up
  9413. OTHERWISE
  9414.    RETURN "\!"+T_TRANSPORT_LOC
  9415. ENDCASE
  9416.  
  9417. *
  9418. * RDVALID() - Prompts for overwriting all objects if g_allobjects is true
  9419. *
  9420. *!*****************************************************************************
  9421. *!
  9422. *!       Function: RDVALID
  9423. *!
  9424. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9425. *!
  9426. *!          Calls: VERSIONCAP()       (function  in TRANSPRT.PRG)
  9427. *!
  9428. *!*****************************************************************************
  9429. FUNCTION rdvalid
  9430. PARAMETER dlgnum
  9431. IF m.gAShowMe[m.g_tpFileIndx,1] AND m.g_allobjects AND m.dlgnum = 1 AND m.choice = 1
  9432.     IF MESSAGEBOX(C_OVERWRITE1_LOC + versioncap(m.g_toplatform) + C_OVERWRITE2_LOC,MB_OKCANCEL) = IDCANCEL
  9433.         RETURN .F.
  9434.     ELSE
  9435.         RETURN .T.
  9436.     ENDIF
  9437. ENDIF
  9438.  
  9439. *
  9440. * DEACCLAU - Deactivate clause code.  Clear current read if window closes.
  9441. *
  9442. *!*****************************************************************************
  9443. *!
  9444. *!       Function: DEACCLAU
  9445. *!
  9446. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9447. *!
  9448. *!*****************************************************************************
  9449. FUNCTION deacclau
  9450. CLEAR READ
  9451. RETURN .T.
  9452.  
  9453. *
  9454. * SHOWCLAU - Refresh GETS
  9455. *
  9456. *!*****************************************************************************
  9457. *!
  9458. *!       Function: SHOWCLAU
  9459. *!
  9460. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9461. *!
  9462. *!*****************************************************************************
  9463. FUNCTION showclau
  9464. IF m.dlgnum = 2
  9465.    RETURN
  9466. ENDIF
  9467.  
  9468. IF g_snippets=.T. OR g_newobjects = .T.
  9469.    SHOW GET g_allobjects DISABLE
  9470. ELSE
  9471.    SHOW GET g_allobjects ENABLE
  9472. ENDIF
  9473.  
  9474. m.thestring = T_THAN_LOC+versioncap(m.g_toplatform)+T_EQIVOBJS_LOC
  9475. IF g_allobjects
  9476.    SHOW GET g_snippets   DISABLE
  9477.    SHOW GET g_newobjects DISABLE
  9478.    DO CASE
  9479. *   CASE _WINDOWS AND RGBSCHEME(1,10) <> "RGB(128,128,128,192,192,192)"
  9480. *      @ 17.846,7.500 SAY m.thestring ;
  9481. *         COLOR (RGBSCHEME(1,10))
  9482.    CASE _WINDOWS && AND RGBSCHEME(1,10) == "RGB(0,0,0,255,255,255)"
  9483.       @ 17.846,7.500 SAY m.thestring ;
  9484.          COLOR RGB(128,128,128,192,192,192)
  9485.    CASE  _MAC AND RGBSCHEME(1,10) <> "RGB(0,0,0,255,255,255)"
  9486.       @ 15.846,7.500 SAY m.thestring ;
  9487.          SIZE 1.000,30.000 ;
  9488.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9489.          STYLE m.g_tdlgstyle ;
  9490.            COLOR (RGBSCHEME(1,10))
  9491.    CASE  _MAC AND RGBSCHEME(1,10) == "RGB(0,0,0,255,255,255)"
  9492.       @ 15.846,7.500 SAY m.thestring ;
  9493.          SIZE 1.000,30.000 ;
  9494.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9495.          STYLE m.g_tdlgstyle    ;
  9496.          COLOR RGB(192,192,192,255,255,255)
  9497.    OTHERWISE
  9498.       @ 14,8 SAY m.thestring ;
  9499.          COLOR (SCHEME(5,10))
  9500.    ENDCASE
  9501. ELSE
  9502.    SHOW GET g_snippets   ENABLE
  9503.    SHOW GET g_newobjects ENABLE
  9504.    DO CASE
  9505.    CASE _WINDOWS
  9506.       @ 17.846,7.500 SAY m.thestring
  9507.    CASE _MAC
  9508.       @ 15.846,7.500 SAY m.thestring ;
  9509.          SIZE 1.000,33.000 ;
  9510.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9511.          STYLE m.g_tdlgsty1
  9512.    OTHERWISE
  9513.       @ 14,8 SAY m.thestring
  9514.    ENDCASE
  9515. ENDIF
  9516.  
  9517. IF !g_allobjects AND g_snippets = .F. AND g_newobjects = .F.
  9518.    SHOW GET m.choice,1 DISABLE
  9519. ELSE
  9520.    SHOW GET m.choice,1 ENABLE
  9521. ENDIF
  9522.  
  9523. *
  9524. * SCRNCTRL - Called for check box validation from the first dialog
  9525. *
  9526. *!*****************************************************************************
  9527. *!
  9528. *!       Function: SCRNCTRL
  9529. *!
  9530. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9531. *!
  9532. *!*****************************************************************************
  9533. FUNCTION scrnctrl
  9534. SHOW GETS OFF
  9535. RETURN .T.
  9536.  
  9537. *
  9538. * Makes sure the proper options are enabled based on the setting of m.g_allobjects
  9539. *
  9540. *!*****************************************************************************
  9541. *!
  9542. *!       Function: ENABLEPROC
  9543. *!
  9544. *!*****************************************************************************
  9545. FUNCTION enableproc
  9546. IF m.g_allobjects
  9547.    SHOW GET m.g_newobjects DISABLE
  9548.    SHOW GET m.g_snippets DISABLE
  9549. ELSE
  9550.    SHOW GET m.g_newobjects ENABLE
  9551.    SHOW GET m.g_snippets ENABLE
  9552. ENDIF
  9553.  
  9554. *
  9555. * Fills the m.g_fromplatform global variable when the user leaves the dialog.
  9556. *
  9557. *!*****************************************************************************
  9558. *!
  9559. *!       Function: PVALID
  9560. *!
  9561. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9562. *!
  9563. *!*****************************************************************************
  9564. FUNCTION pvalid
  9565. DO CASE
  9566. CASE ATC('DOS',m.fromplatform) > 0
  9567.    m.g_fromplatform = 'DOS'
  9568. CASE ATC('WINDOWS',m.fromplatform) > 0
  9569.    m.g_fromplatform = 'WINDOWS'
  9570. CASE ATC('MAC',m.fromplatform) > 0
  9571.    m.g_fromplatform = 'MAC'
  9572. CASE ATC('UNIX',m.fromplatform) > 0
  9573.    m.g_fromplatform = 'UNIX'
  9574. ENDCASE
  9575.  
  9576. **
  9577. ** Code Associated With Displaying of the Thermometer
  9578. **
  9579.  
  9580. *!*****************************************************************************
  9581. *!
  9582. *!      Procedure: STARTTHERM
  9583. *!
  9584. *!      Called by: TRANSPRT.PRG
  9585. *!               : GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  9586. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  9587. *!
  9588. *!          Calls: ACTTHERM           (procedure in TRANSPRT.PRG)
  9589. *!
  9590. *!*****************************************************************************
  9591. PROCEDURE starttherm
  9592. PARAMETER VERB,filetype
  9593. *  Start the thermometer with the appropriate message.
  9594. DO CASE
  9595. CASE m.filetype = c_screen
  9596.    DO acttherm WITH VERB+T_THERMSCR_LOC
  9597. CASE m.filetype = c_report
  9598.    DO acttherm WITH VERB+T_THERMRPT_LOC
  9599. CASE m.filetype  = c_label
  9600.    DO acttherm WITH VERB+T_THERMLBL_LOC
  9601. ENDCASE
  9602.  
  9603.  
  9604. *!*****************************************************************************
  9605. *!
  9606. *!      Procedure: THERMFNAME
  9607. *!
  9608. *!*****************************************************************************
  9609. FUNCTION thermfname
  9610. PARAMETER m.fname
  9611. PRIVATE m.addelipse, m.g_pathsep, m.g_thermfface, m.g_thermfsize, m.g_thermfstyle
  9612.  
  9613. IF _MAC
  9614.     m.g_thermfface = "Geneva"
  9615.     m.g_thermfsize = 10
  9616.     m.g_thermfstyle = ""
  9617. ELSE
  9618.     m.g_thermfface = "MS Sans Serif"
  9619.     m.g_thermfsize = 8
  9620.     m.g_thermfstyle = "B"
  9621. ENDIF
  9622.  
  9623. * Translate the filename into Mac native format
  9624. IF _MAC
  9625.     m.g_pathsep = ":"
  9626.     m.fname = SYS(2027, m.fname)
  9627. ELSE
  9628.     m.g_pathsep = "\"
  9629. ENDIF
  9630.  
  9631. IF TXTWIDTH(m.fname,m.g_thermfface,m.g_thermfsize,m.g_thermfstyle) > c_space
  9632.     * Make it fit in c_space
  9633.     m.fname = partialfname(m.fname, c_space - 1)
  9634.  
  9635.     m.addelipse = .F.
  9636.     DO WHILE TXTWIDTH(m.fname+'...',m.g_thermfface,m.g_thermfsize,m.g_thermfstyle) > c_space
  9637.         m.fname = LEFT(m.fname, LEN(m.fname) - 1)
  9638.         m.addelipse = .T.
  9639.     ENDDO
  9640.     IF m.addelipse
  9641.         m.fname = m.fname + "..."
  9642.    ENDIF
  9643. ENDIF
  9644. RETURN m.fname
  9645.  
  9646.  
  9647.  
  9648. *!*****************************************************************************
  9649. *!
  9650. *!      Procedure: PARTIALFNAME
  9651. *!
  9652. *!*****************************************************************************
  9653. FUNCTION partialfname
  9654. PARAMETER m.filname, m.fillen
  9655. * Return a filname no longer than m.fillen characters.  Take some chars
  9656. * out of the middle if necessary.  No matter what m.fillen is, this function
  9657. * always returns at least the file stem and extension.
  9658. PRIVATE m.bname, m.elipse, m.remain
  9659. m.elipse = "..." + m.g_pathsep
  9660. IF _MAC
  9661.     m.bname = SUBSTR(m.filname, RAT(":",m.filname)+1)
  9662. ELSE
  9663.     m.bname = justfname(m.filname)
  9664. ENDIF
  9665. DO CASE
  9666. CASE LEN(m.filname) <= m.fillen
  9667.    m.retstr = m.filname
  9668. CASE LEN(m.bname) + LEN(m.elipse) >= m.fillen
  9669.    m.retstr = m.bname
  9670. OTHERWISE
  9671.    m.remain = MAX(m.fillen - LEN(m.bname) - LEN(m.elipse), 0)
  9672.    IF _MAC
  9673.        m.retstr = LEFT(SUBSTR(m.filname,1,RAT(":",m.filname)-1),m.remain) ;
  9674.             +m.elipse+m.bname
  9675.    ELSE
  9676.          m.retstr = LEFT(justpath(m.filname),m.remain)+m.elipse+m.bname
  9677.    ENDIF
  9678. ENDCASE
  9679. RETURN m.retstr
  9680.  
  9681.  
  9682. *
  9683. * ACTTHERM(<text>) - Activate thermometer.
  9684. *
  9685. * Activates thermometer.  Update the thermometer with UPDTHERM().
  9686. * Thermometer window is named "thermometer."  Be sure to RELEASE
  9687. * this window when done with thermometer.  Creates the global
  9688. * m.g_thermwidth.
  9689. *
  9690. *!*****************************************************************************
  9691. *!
  9692. *!      Procedure: ACTTHERM
  9693. *!
  9694. *!      Called by: STARTTHERM         (procedure in TRANSPRT.PRG)
  9695. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  9696. *!
  9697. *!*****************************************************************************
  9698. PROCEDURE acttherm
  9699. PARAMETER m.text
  9700. PRIVATE m.prompt
  9701.  
  9702. *- for converter, hide separate therm
  9703. RETURN
  9704.  
  9705. DO CASE
  9706. CASE _WINDOWS
  9707.    m.prompt = LOWER(m.g_scrndbf)
  9708.     m.prompt = thermfname(m.prompt)
  9709.    IF !WEXIST("thermomete")
  9710.       DEFINE WINDOW thermomete ;
  9711.          AT 0,0 ;
  9712.          SIZE 5.615,63.833 ;
  9713.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9714.          STYLE m.g_tdlgstyle ;
  9715.          NOFLOAT ;
  9716.          NOCLOSE ;
  9717.          NONE ;
  9718.          COLOR RGB(0, 0, 0, 192, 192, 192)
  9719.    ENDIF
  9720.    MOVE WINDOW thermomete CENTER
  9721.    ACTIVATE WINDOW thermomete NOSHOW
  9722.  
  9723.    @ 0.5,3 SAY m.text FONT m.g_tdlgface, m.g_tdlgsize STYLE m.g_tdlgstyle
  9724.    @ 1.5,3 SAY m.prompt FONT m.g_tdlgface, m.g_tdlgsize STYLE m.g_tdlgstyle
  9725.    @ 0.000,0.000 TO 0.000,63.833 ;
  9726.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9727.    @ 0.000,0.000 TO 5.615,0.000 ;
  9728.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9729.    @ 0.385,0.667 TO 5.231,0.667 ;
  9730.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9731.    @ 0.308,0.667 TO 0.308,63.167 ;
  9732.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9733.    @ 0.385,63.000 TO 5.308,63.000 ;
  9734.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9735.    @ 5.231,0.667 TO 5.231,63.167 ;
  9736.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9737.    @ 5.538,0.000 TO 5.538,63.833 ;
  9738.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9739.    @ 0.000,63.667 TO 5.615,63.667 ;
  9740.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9741.    @ 3.000,3.333 TO 4.231,3.333 ;
  9742.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9743.    @ 3.000,60.333 TO 4.308,60.333 ;
  9744.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9745.    @ 3.000,3.333 TO 3.000,60.333 ;
  9746.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9747.    @ 4.231,3.333 TO 4.231,60.333 ;
  9748.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9749.    m.g_thermwidth = 56.269
  9750.  
  9751. CASE _MAC
  9752.    m.prompt = LOWER(m.g_scrndbf)
  9753.       m.prompt = thermfname(m.prompt)
  9754.    IF !WEXIST("thermomete")
  9755.       DEFINE WINDOW thermomete ;
  9756.          AT  INT((SROW() - (( 5.62 * ;
  9757.          FONTMETRIC(1, m.g_thermface, m.g_thermsize, m.g_thermstyle )) / ;
  9758.          FONTMETRIC(1, WFONT(1,""), WFONT( 2,""), WFONT(3,"")))) / 2), ;
  9759.          INT((SCOL() - (( 63.83 * ;
  9760.          FONTMETRIC(6, m.g_thermface, m.g_thermsize, m.g_thermstyle )) / ;
  9761.          FONTMETRIC(6, WFONT(1,""), WFONT( 2,""), WFONT(3,"")))) / 2) ;
  9762.          SIZE 5.62,63.83 ;
  9763.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9764.          STYLE m.g_tdlgstyle ;
  9765.          NOFLOAT ;
  9766.          NOCLOSE ;
  9767.             NONE ;
  9768.          COLOR RGB(0, 0, 0, 192, 192, 192)
  9769.    ENDIF
  9770.    MOVE WINDOW thermomete CENTER
  9771.    ACTIVATE WINDOW thermomete NOSHOW
  9772.  
  9773.    IF ISCOLOR()
  9774.       @ 0.000,0.000 TO 5.62,63.83 PATTERN 1;
  9775.          COLOR RGB(192, 192, 192, 192, 192, 192)
  9776.        @ 0.000,0.000 TO 0.000,63.83 ;
  9777.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9778.        @ 0.000,0.000 TO 5.62,0.000 ;
  9779.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9780.        @ 0.385,0.67 TO 5.23,0.67 ;
  9781.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9782.        @ 0.31,0.67 TO 0.31,63.17 ;
  9783.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9784.        @ 0.385,63.000 TO 5.31,63.000 ;
  9785.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9786.        @ 5.23,0.67 TO 5.23,63.17 ;
  9787.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9788.        @ 5.54,0.000 TO 5.54,63.83 ;
  9789.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9790.        @ 0.000,63.67 TO 5.62,63.67 ;
  9791.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9792.        @ 3.000,3.33 TO 4.23,3.33 ;
  9793.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9794.        @ 3.000,60.33 TO 4.31,60.33 ;
  9795.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9796.        @ 3.000,3.33 TO 3.000,60.33 ;
  9797.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9798.        @ 4.23,3.33 TO 4.23,60.33 ;
  9799.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9800.    ELSE
  9801.       @ 0.000, 0.000 TO 5.62, 63.830  PEN 2
  9802.       @ 0.230, 0.430 TO 5.39, 63.400  PEN 1
  9803.    ENDIF
  9804.    @ 0.5,3 SAY m.text FONT m.g_thermface, m.g_thermsize STYLE m.g_thermstyle ;
  9805.       COLOR RGB(0,0,0,192,192,192)
  9806.    @ 1.5,3 SAY m.prompt FONT m.g_thermface, m.g_thermsize STYLE m.g_thermstyle ;
  9807.       COLOR RGB(0,0,0,192,192,192)
  9808.  
  9809.    m.g_thermwidth = 57.17
  9810.     IF !ISCOLOR()
  9811.        @ 3.000,3.33 TO 4.23,m.g_thermwidth + 3.33
  9812.     ENDIF
  9813.  
  9814.    SHOW WINDOW thermomete TOP
  9815. CASE _DOS OR _UNIX
  9816.    m.prompt = SUBSTR(SYS(2014,m.g_scrndbf),1,48)+;
  9817.       IIF(LEN(m.g_scrndbf)>48,"...","")
  9818.    IF !WEXIST("thermomete")
  9819.       DEFINE WINDOW thermomete;
  9820.          FROM INT((SROW()-7)/2), INT((SCOL()-57)/2) ;
  9821.          TO INT((SROW()-7)/2) + 6, INT((SCOL()-57)/2) + 57;
  9822.          DOUBLE COLOR SCHEME 5
  9823.    ENDIF
  9824.    ACTIVATE WINDOW thermomete NOSHOW
  9825.  
  9826.    m.g_thermwidth = 50
  9827.    @ 0,3 SAY m.text
  9828.    @ 1,3 SAY UPPER(m.prompt)
  9829.    @ 2,1 TO 4,m.g_thermwidth+4 &g_boxstrg
  9830.  
  9831.    SHOW WINDOW thermomete TOP
  9832. ENDCASE
  9833. RETURN
  9834.  
  9835. *
  9836. * UPDTHERM(<percent>) - Update thermometer.
  9837. *
  9838. *!*****************************************************************************
  9839. *!
  9840. *!      Procedure: UPDTHERM
  9841. *!
  9842. *!      Called by: TRANSPRT.PRG
  9843. *!               : GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  9844. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  9845. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  9846. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  9847. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  9848. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  9849. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  9850. *!               : ALLENVIRONS        (procedure in TRANSPRT.PRG)
  9851. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  9852. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  9853. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  9854. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  9855. *!               : CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  9856. *!               : FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  9857. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  9858. *!               : ADJINVBTNS         (procedure in TRANSPRT.PRG)
  9859. *!               : JOINLINES          (procedure in TRANSPRT.PRG)
  9860. *!               : WRITERESULT        (procedure in TRANSPRT.PRG)
  9861. *!
  9862. *!          Calls: ACTTHERM           (procedure in TRANSPRT.PRG)
  9863. *!
  9864. *!*****************************************************************************
  9865. PROCEDURE updtherm
  9866. PARAMETER m.percent
  9867. PRIVATE m.nblocks, m.percent
  9868.  
  9869. *- for converter, use gOTherm
  9870. IF TYPE("gOTherm") == "O"
  9871.     gOTherm.Update(MIN(MAX(m.percent,0),100))
  9872. ENDIF
  9873. RETURN
  9874.  
  9875. IF m.percent > 100
  9876.    m.percent = 100
  9877. ENDIF
  9878. IF m.percent < 0
  9879.    m.percent = 0
  9880. ENDIF
  9881.  
  9882. IF !WEXIST("thermomete")
  9883.    DO acttherm WITH ""
  9884. ENDIF
  9885. ACTIVATE WINDOW thermomete
  9886.  
  9887. m.nblocks = (m.percent/100) * (m.g_thermwidth)
  9888. DO CASE
  9889. CASE _WINDOWS
  9890.    @ 3.000,3.333 TO 4.231,m.nblocks + 3.333 ;
  9891.       PATTERN 1 COLOR RGB(128, 128, 128, 128, 128, 128)
  9892. CASE _MAC
  9893.    @ 3.000,3.33 TO 4.23,m.nblocks + 3.33 ;
  9894.       PATTERN 1 COLOR RGB(0, 0, 128, 0, 0, 128)
  9895. OTHERWISE
  9896.    @ 3,3 SAY REPLICATE("█",m.nblocks)
  9897. ENDCASE
  9898. RETURN
  9899.  
  9900. *
  9901. * deactTherm - Deactivate and Release thermometer window.
  9902. *
  9903. *!*****************************************************************************
  9904. *!
  9905. *!      Procedure: DEACTTHERM
  9906. *!
  9907. *!      Called by: CLEANUP            (procedure in TRANSPRT.PRG)
  9908. *!
  9909. *!*****************************************************************************
  9910. PROCEDURE deacttherm
  9911. IF WEXIST("thermomete")
  9912.    RELEASE WINDOW thermomete
  9913. ENDIF
  9914. RETURN
  9915.  
  9916. *
  9917. * ERRORHANDLER - Error Processing Center.
  9918. *
  9919. *!*****************************************************************************
  9920. *!
  9921. *!      Procedure: ERRORHANDLER
  9922. *!
  9923. *!      Called by: TRANSPRT.PRG
  9924. *!               : SETVERSION         (procedure in TRANSPRT.PRG)
  9925. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  9926. *!               : STRUCTDIALOG()     (function  in TRANSPRT.PRG)
  9927. *!               : SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9928. *!
  9929. *!          Calls: CLEANUP            (procedure in TRANSPRT.PRG)
  9930. *!               : ERRSHOW            (procedure in TRANSPRT.PRG)
  9931. *!               : CLEANWIND          (procedure in TRANSPRT.PRG)
  9932. *!
  9933. *!*****************************************************************************
  9934. PROCEDURE errorhandler
  9935. PARAMETERS m.msg, m.linenum, errcode
  9936. IF ERROR() = 22
  9937.    ON ERROR &onerror
  9938.    m.g_status = 1
  9939.    DO cleanup
  9940.    CANCEL
  9941. ENDIF
  9942. SET MESSAGE TO
  9943. DO CASE
  9944. CASE errcode == c_error1
  9945.    m.g_status = 1
  9946. CASE errcode == c_error2
  9947.    DO errshow WITH m.msg, m.linenum
  9948.    m.g_status = 2
  9949.    ON ERROR &onerror
  9950. CASE errcode == c_error3
  9951.    ON ERROR &onerror
  9952.    DO errshow WITH m.msg, m.linenum
  9953.    DO cleanwind
  9954.    m.g_status = 3
  9955.    m.g_returncode = c_cancel
  9956.    DO cleanup WITH .T.
  9957. ENDCASE
  9958.  
  9959. *
  9960. * CLEANWIND - Release windows that might still be open
  9961. *
  9962. *!*****************************************************************************
  9963. *!
  9964. *!      Procedure: CLEANWIND
  9965. *!
  9966. *!      Called by: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  9967. *!               : ESCHANDLER         (procedure in TRANSPRT.PRG)
  9968. *!
  9969. *!*****************************************************************************
  9970. PROCEDURE cleanwind
  9971. IF WEXIST("transdlg") AND WVISIBLE("transdlg")
  9972.    RELEASE WINDOW transdlg
  9973. ENDIF
  9974. IF WEXIST("lblwind") AND WVISIBLE("lblwind")
  9975.    RELEASE WINDOW lblwind
  9976. ENDIF
  9977. IF WEXIST("msgscrn") AND WVISIBLE("msgscrn")
  9978.    RELEASE WINDOW msgscrn
  9979. ENDIF
  9980. IF WEXIST("Thermomete") AND WVISIBLE("Thermomete")
  9981.    RELEASE WINDOW thermomete
  9982. ENDIF
  9983. IF WEXIST("tpselect") AND WVISIBLE("tpselect")
  9984.    RELEASE WINDOW tpselect
  9985. ENDIF
  9986.  
  9987. *
  9988. * ESCHANDLER - Escape handler.
  9989. *
  9990. *!*****************************************************************************
  9991. *!
  9992. *!      Procedure: ESCHANDLER
  9993. *!
  9994. *!      Called by: SETALL             (procedure in TRANSPRT.PRG)
  9995. *!
  9996. *!          Calls: CLEANWIND          (procedure in TRANSPRT.PRG)
  9997. *!               : CLEANUP            (procedure in TRANSPRT.PRG)
  9998. *!
  9999. *!*****************************************************************************
  10000. *PROCEDURE eschandler
  10001. *ON ERROR &onerror
  10002. *m.g_status = 1
  10003. *DO cleanwind
  10004. *DO cleanup
  10005. *CANCEL
  10006.  
  10007. *
  10008. * ERRSHOW - Show error in an alert box on the screen.
  10009. *
  10010. *!*****************************************************************************
  10011. *!
  10012. *!      Procedure: ERRSHOW
  10013. *!
  10014. *!      Called by: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  10015. *!
  10016. *!*****************************************************************************
  10017. PROCEDURE errshow
  10018. PARAMETER m.msg, m.lineno
  10019. PRIVATE m.curcursor
  10020.  
  10021. DO CASE
  10022. CASE _WINDOWS
  10023.    DEFINE WINDOW ALERT ;
  10024.       AT 0,0 ;
  10025.       SIZE 5.615,63.833 ;
  10026.       FONT m.g_tdlgface, m.g_tdlgsize ;
  10027.       STYLE m.g_tdlgstyle ;
  10028.       NOCLOSE ;
  10029.       DOUBLE ;
  10030.       TITLE T_TRANSPERR_LOC 
  10031.    MOVE WINDOW ALERT CENTER
  10032.    ACTIVATE WINDOW ALERT NOSHOW
  10033.  
  10034.    m.msg = SUBSTR(m.msg,1,44)+IIF(LEN(m.msg)>44,"...","")
  10035.    @ 1,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10036.  
  10037.    m.msg = T_LINENO_LOC+LTRIM(STR(m.lineno,5))
  10038.    @ 2,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10039.  
  10040.    m.msg = T_CLEANUP_LOC
  10041.    @ 3,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10042. CASE _MAC
  10043.    DEFINE WINDOW ALERT ;
  10044.       AT 0,0 ;
  10045.       SIZE 5.615,63.833 ;
  10046.       FONT m.g_tdlgface, m.g_tdlgsize ;
  10047.       STYLE m.g_tdlgstyle ;
  10048.       NOCLOSE ;
  10049.       DOUBLE ;
  10050.       TITLE T_TRANSPERR_LOC 
  10051.    MOVE WINDOW ALERT CENTER
  10052.    ACTIVATE WINDOW ALERT NOSHOW
  10053.  
  10054.    m.msg = SUBSTR(m.msg,1,44)+IIF(LEN(m.msg)>44,"...","")
  10055.    @ 1,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10056.  
  10057.    m.msg = T_LINENO_LOC+LTRIM(STR(m.lineno,5))
  10058.    @ 2,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10059.  
  10060.    m.msg = T_CLEANUP_LOC
  10061.    @ 3,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10062. OTHERWISE
  10063.    DEFINE WINDOW ALERT;
  10064.       FROM INT((SROW()-6)/2), INT((SCOL()-50)/2) ;
  10065.       TO INT((SROW()-6)/2) + 6, INT((SCOL()-50)/2) + 50;
  10066.       FLOAT NOGROW NOCLOSE NOZOOM   SHADOW DOUBLE;
  10067.       COLOR SCHEME 7
  10068.  
  10069.    ACTIVATE WINDOW ALERT NOSHOW
  10070.  
  10071.    m.msg = SUBSTR(m.msg,1,44)+IIF(LEN(m.msg)>44,"...","")
  10072.    @ 1,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  10073.  
  10074.    m.msg = T_LINENO_LOC+STR(m.lineno, 5)
  10075.    @ 2,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  10076.  
  10077.    m.msg = T_CLEANUP_LOC
  10078.    @ 3,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  10079. ENDCASE
  10080.  
  10081. m.curcursor = SET( "CURSOR" )
  10082. SET CURSOR OFF
  10083. SHOW WINDOW ALERT
  10084.  
  10085. =INKEY(0, "M")
  10086.  
  10087. RELEASE WINDOW ALERT
  10088. SET CURSOR &curcursor
  10089.  
  10090. *
  10091. * JUSTSTEM - Returns just the stem name of the file
  10092. *
  10093. *!*****************************************************************************
  10094. *!
  10095. *!       Function: JUSTSTEM
  10096. *!
  10097. *!*****************************************************************************
  10098. FUNCTION juststem
  10099. * Return just the stem name from "filname"
  10100. PARAMETERS m.filname
  10101. PRIVATE ALL
  10102. IF RAT('\',m.filname) > 0
  10103.    m.filname = SUBSTR(m.filname,RAT('\',m.filname)+1,255)
  10104. ENDIF
  10105. IF AT(':',m.filname) > 0
  10106.    m.filname = SUBSTR(m.filname,AT(':',m.filname)+1,255)
  10107. ENDIF
  10108. IF AT('.',m.filname) > 0
  10109.    m.filname = SUBSTR(m.filname,1,AT('.',m.filname)-1)
  10110. ENDIF
  10111. RETURN ALLTRIM(UPPER(m.filname))
  10112.  
  10113. *
  10114. * STRIPPATH - Strip the path from a file name.
  10115. *
  10116. * Description:
  10117. * Find positions of backslash in the name of the file.  If there is one
  10118. * take everything to the right of its position and make it the new file
  10119. * name.  If there is no slash look for colon.  Again if found, take
  10120. * everything to the right of it as the new name.  If neither slash
  10121. * nor colon are found then return the name unchanged.
  10122. *
  10123. * Parameters:
  10124. * filename - character string representing a file name
  10125. *
  10126. * Return value:
  10127. * The string "filename" with any path removed
  10128. *
  10129. *!*****************************************************************************
  10130. *!
  10131. *!       Function: STRIPPATH
  10132. *!
  10133. *!      Called by: TRANSPRT.PRG
  10134. *!               : ADJBITMAPCTRL      (procedure in TRANSPRT.PRG)
  10135. *!               : SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10136. *!
  10137. *!*****************************************************************************
  10138. FUNCTION strippath
  10139. PARAMETER m.filename
  10140. PRIVATE m.slashpos, m.namelen, m.colonpos
  10141. m.slashpos = RAT("\", m.filename)
  10142. IF m.slashpos > 0
  10143.    m.namelen  = LEN(m.filename) - m.slashpos
  10144.    m.filename = RIGHT(m.filename, m.namelen)
  10145. ELSE
  10146.    m.colonpos = RAT(":", m.filename)
  10147.    IF m.colonpos > 0
  10148.       m.namelen  = LEN(m.filename) - m.colonpos
  10149.       m.filename = RIGHT(m.filename, m.namelen)
  10150.    ENDIF
  10151. ENDIF
  10152. RETURN m.filename
  10153.  
  10154. *
  10155. * ISOBJECT - Is otype a screen or report object?
  10156. *
  10157. *!*****************************************************************************
  10158. *!
  10159. *!       Function: ISOBJECT
  10160. *!
  10161. *!      Called by: UPDATESCREEN       (procedure in TRANSPRT.PRG)
  10162. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  10163. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  10164. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  10165. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  10166. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  10167. *!
  10168. *!*****************************************************************************
  10169. FUNCTION isobject
  10170. PARAMETER m.otype
  10171. RETURN INLIST(m.otype,c_otlist,c_ottxtbut,c_otbox,c_otradbut,c_otchkbox,c_otfield, ;
  10172.    c_otpopup,c_otinvbut,c_otspinner,c_otpicture,c_otline,c_otrepfld,c_otrepvar,c_ottext)
  10173.  
  10174.  
  10175. *
  10176. * ISREPTOBJECT - Is otype a report object?
  10177. *
  10178. *!*****************************************************************************
  10179. *!
  10180. *!       Function: ISREPTOBJECT
  10181. *!
  10182. *!      Called by: RPTCONVERT         (procedure in TRANSPRT.PRG)
  10183. *!
  10184. *!*****************************************************************************
  10185. FUNCTION isreptobject
  10186. PARAMETER m.otype
  10187. RETURN INLIST(m.otype,c_otrepfld,c_ottext,c_otbox,c_otline)
  10188.  
  10189. *
  10190. * ISGRAPHOBJ - Is otype an object that is present in graphics screens/reports but not
  10191. *              in character screens?
  10192. *
  10193. *!*****************************************************************************
  10194. *!
  10195. *!       Function: ISGRAPHOBJ
  10196. *!
  10197. *!*****************************************************************************
  10198. FUNCTION isgraphobj
  10199. PARAMETER m.otype
  10200. RETURN INLIST(m.otype,c_otpicture,c_otspinner)
  10201.  
  10202. *!*****************************************************************************
  10203. *!
  10204. *!       Function: ISENVIRON
  10205. *!
  10206. *!*****************************************************************************
  10207. FUNCTION isenviron
  10208. PARAMETER m.otype
  10209. RETURN INLIST(m.otype,c_otworkar,c_otindex,c_otrel)
  10210.  
  10211. *!*****************************************************************************
  10212. *!
  10213. *!       Function: IsNewerEnv
  10214. *!
  10215. *!*****************************************************************************
  10216. FUNCTION IsNewerEnv
  10217. PARAMETER m.mustexist    && does the "to" environment have to exist?
  10218. PRIVATE m.maxfromts, m.maxtots
  10219. * Is the "from" platform environment newer than the "to" platform environment
  10220. m.maxfromts = -1
  10221. SCAN FOR platform = m.g_fromplatform and IsEnviron(objtype)
  10222.    m.maxfromts = MAX(timestamp, m.maxfromts)
  10223. ENDSCAN
  10224. m.maxtots = -1
  10225. SCAN FOR platform = m.g_toplatform and IsEnviron(objtype)
  10226.    m.maxtots = MAX(timestamp, m.maxtots)
  10227. ENDSCAN
  10228. IF m.mustexist
  10229.    * The to platform had an environment, but it was out of date
  10230.    RETURN IIF(m.maxfromts > m.maxtots AND m.maxtots >= 0 , .T. , .F.)
  10231. ELSE
  10232.    * The to platform had no environment and the from platform does
  10233.    RETURN IIF(m.maxfromts >= 0 AND m.maxtots < 0  , .T. , .F.)
  10234. ENDIF
  10235.  
  10236. *
  10237. * HASRECORD - Does filname contain platform records for target?
  10238. *
  10239. *!*****************************************************************************
  10240. *!
  10241. *!       Function: HASRECORDS
  10242. *!
  10243. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10244. *!
  10245. *!*****************************************************************************
  10246. FUNCTION hasrecords
  10247. PARAMETER m.target
  10248. PRIVATE m.inrec, m.retval
  10249. m.inrec = RECNO()
  10250. DO CASE
  10251. CASE TYPE("PLATFORM") <> "U"
  10252.    LOCATE FOR UPPER(ALLTRIM(platform)) == UPPER(ALLTRIM(m.target))
  10253.    m.retval = FOUND()
  10254. CASE UPPER(ALLTRIM(m.target)) == "DOS"
  10255.    m.retval = .T.   && assume DOS if no platform field
  10256. OTHERWISE
  10257.    m.retval = .F.
  10258. ENDCASE
  10259. GOTO m.inrec
  10260. RETURN m.retval
  10261.  
  10262.  
  10263. *!*****************************************************************************
  10264. *!
  10265. *!       Function: setctrl
  10266. *!
  10267. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10268. *!
  10269. *!*****************************************************************************
  10270. FUNCTION setctrl
  10271. * This function is called during Transporter setup to initialize some of
  10272. * the font selections.  It is also called as the valid() routine when
  10273. * the 2D controls checkbox is checked.
  10274. DO CASE
  10275. CASE _MAC
  10276.     * Set fonts based on 2D/3D choice--Mac only
  10277.     IF m.g_look2d
  10278.        * Push button and controls font.  Font button does not override this.
  10279.        m.g_ctrlfface        = "Chicago"
  10280.        m.g_ctrlfsize        = 12
  10281.        m.g_ctrlfstyle       = ""
  10282.  
  10283.         * Window measurement font
  10284.        m.g_windfface        = "Chicago"
  10285.        m.g_windfsize        = 12
  10286.        m.g_windfstyle       = ""
  10287.  
  10288.         * Set default font for SCX/FRX objects (e.g., text).
  10289.         * The Font button may override this.
  10290.        m.g_dfltfface         = "Geneva"
  10291.        m.g_dfltfsize         = 10
  10292.        m.g_dfltfstyle        = ""
  10293.  
  10294.         m.g_macbtnheight = 1.125
  10295.         m.g_macbtnface   = "Chicago"
  10296.         m.g_macbtnsize   = 12
  10297.         m.g_macbtnstyle  = ""
  10298.     ELSE
  10299.        m.g_ctrlfface        = "Geneva"
  10300.        m.g_ctrlfsize        = 9
  10301.        m.g_ctrlfstyle       = "B"
  10302.  
  10303.         * The cxChar for Geneva, 10 nonbold is 6 pixels, just like
  10304.          * MS Sans Serif,8 bold.  This is a good mapping for screens coming
  10305.         * over from Windows.
  10306.        m.g_windfface        = "Geneva"
  10307.        m.g_windfsize        = 10
  10308.        m.g_windfstyle       = ""
  10309.  
  10310.         * Set default font for SCX objects.  The Font button may
  10311.          * override this.
  10312.        m.g_dfltfface         = "Geneva"
  10313.        m.g_dfltfsize         = 10
  10314.        m.g_dfltfstyle        = ""
  10315.  
  10316.         m.g_macbtnheight = 1.500
  10317.         m.g_macbtnface   = "Geneva"
  10318.         m.g_macbtnsize   = 10
  10319.         m.g_macbtnstyle  = "B"
  10320.     ENDIF
  10321.    m.g_winbtnheight = 1.769
  10322.     m.g_winbtnface   = "MS Sans Serif"
  10323.     m.g_winbtnsize   = 8
  10324.     m.g_winbtnstyle  = "B"
  10325.  
  10326.     m.g_thermface    = "Geneva"
  10327.     m.g_thermsize    = 10
  10328.     m.g_thermstyle   = "T"
  10329.     m.g_btnheight    = m.g_macbtnheight
  10330. OTHERWISE
  10331.    * Font for push buttons
  10332.    m.g_ctrlfface        = "MS Sans Serif"
  10333.    m.g_ctrlfsize        = 8
  10334.    m.g_ctrlfstyle       = "B"
  10335.  
  10336.     * Window measurement font
  10337.    m.g_windfface        = "MS Sans Serif"
  10338.    m.g_windfsize        = 8
  10339.    m.g_windfstyle       = "B"
  10340.  
  10341.    * Font selections for fields/text in the SCX/FRX itself.  May be overridden by user.
  10342.    *- use remembered settings
  10343.    IF EMPTY(gAShowMe[m.g_tpFileIndx,3])
  10344.       m.g_dfltfface         = "MS Sans Serif"
  10345.       m.g_dfltfsize         = 8
  10346.       m.g_dfltfstyle        = "B"
  10347.    ELSE
  10348.        m.g_dfltfface = m.gAShowMe[m.g_tpFileIndx,3]
  10349.        m.g_dfltfsize = m.gAShowMe[m.g_tpFileIndx,4]
  10350.        m.g_dfltfstyle = m.gAShowMe[m.g_tpFileIndx,5]
  10351.    ENDIF
  10352.  
  10353.    m.g_winbtnheight = 1.769
  10354.     m.g_macbtnheight = 1.500      && figure that most screens will be 3D
  10355.     m.g_macbtnface   = "Geneva"
  10356.     m.g_macbtnsize   = 10
  10357.     m.g_macbtnstyle  = "B"
  10358.     m.g_winbtnface   = "MS Sans Serif"
  10359.     m.g_winbtnsize   = 8
  10360.     m.g_winbtnstyle  = "B"
  10361.     m.g_btnheight    = m.g_winbtnheight
  10362.  
  10363. ENDCASE
  10364.  
  10365. *!*****************************************************************************
  10366. *!
  10367. *!       Function: SETRPTFONT
  10368. *!
  10369. *!*****************************************************************************
  10370. PROCEDURE setrptfont
  10371. * Set the default report font for a report coming to the Mac
  10372. * Disabled by WJK
  10373. IF .F. && _MAC AND INLIST(m.g_filetype,c_report,c_label)
  10374.     m.g_windfface        = m.g_rptfface
  10375.     m.g_windfsize        = m.g_rptfsize
  10376.     m.g_windfstyle       = num2style(m.g_rptfstyle)
  10377.  
  10378.     * Set default font for FRX objects.  The Font button may
  10379.     * override this.
  10380.    *- use remembered settings
  10381.    IF EMPTY(gAShowMe[m.g_tpFileIndx,3])
  10382.         m.g_dfltfface         = m.g_rptfface
  10383.         m.g_dfltfsize         = m.g_rptfsize
  10384.         m.g_dfltfstyle        = num2style(m.g_rptfstyle)
  10385.    ELSE
  10386.        m.g_dfltfface = m.gAShowMe[m.g_tpFileIndx,3]
  10387.        m.g_dfltfsize = m.gAShowMe[m.g_tpFileIndx,4]
  10388.        m.g_dfltfstyle = m.gAShowMe[m.g_tpFileIndx,5]
  10389.    ENDIF
  10390.  
  10391. ENDIF
  10392.  
  10393. *
  10394. * ASKFONT - Prompt for a font
  10395. *
  10396. *!*****************************************************************************
  10397. *!
  10398. *!       Function: ASKFONT
  10399. *!
  10400. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10401. *!
  10402. *!*****************************************************************************
  10403. FUNCTION askfont
  10404. PRIVATE m.fontstrg
  10405.  
  10406. *- temp fix here
  10407. IF .F.
  10408.     fontstrg = "Geneva,10,N"
  10409.  
  10410.        m.g_dfltfface   =  LEFT(m.fontstrg,AT(',',m.fontstrg)-1)
  10411.        m.g_dfltfsize   =  VAL(SUBSTR(m.fontstrg,AT(',',m.fontstrg)+1,RAT(',',m.fontstrg)-AT(',',m.fontstrg)-1))
  10412.        m.g_dfltfstyle  =  SUBSTR(m.fontstrg,RAT(',',m.fontstrg)+1)
  10413.        IF _MAC OR _WINDOWS
  10414.           m.g_rptlinesize      = (FONTMETRIC(1, m.g_dfltfface, m.g_dfltfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  10415.           m.g_rptcharsize      = (FONTMETRIC(6, m.g_dfltfface, m.g_dfltfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  10416.        ENDIF
  10417.        m.g_fontset = .T.
  10418.        m.gAShowMe[m.g_tpFileIndx,3] = m.g_dfltfface
  10419.        m.gAShowMe[m.g_tpFileIndx,4] = m.g_dfltfsize
  10420.        m.gAShowMe[m.g_tpFileIndx,5] = m.g_dfltfstyle
  10421.  
  10422.     RETURN
  10423. ENDIF
  10424. *- end temp fix
  10425.  
  10426. * Set up a default font for reports
  10427. IF m.g_filetype = c_report AND (_WINDOWS OR _MAC)
  10428.    DEFINE WINDOW transtemp FROM 1,1 TO 2,2 FONT "&g_rptfface", m.g_rptfsize
  10429.    ACTIVATE WINDOW transtemp NOSHOW
  10430. ENDIF
  10431.  
  10432. m.fontstrg = GETFONT()
  10433.  
  10434. IF !EMPTY(m.fontstrg)
  10435.    m.g_dfltfface   =  LEFT(m.fontstrg,AT(',',m.fontstrg)-1)
  10436.    m.g_dfltfsize   =  VAL(SUBSTR(m.fontstrg,AT(',',m.fontstrg)+1,RAT(',',m.fontstrg)-AT(',',m.fontstrg)-1))
  10437.    m.g_dfltfstyle  =  SUBSTR(m.fontstrg,RAT(',',m.fontstrg)+1)
  10438.    IF _MAC OR _WINDOWS
  10439.       m.g_rptlinesize      = (FONTMETRIC(1, m.g_dfltfface, m.g_dfltfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  10440.       m.g_rptcharsize      = (FONTMETRIC(6, m.g_dfltfface, m.g_dfltfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  10441.    ENDIF
  10442.    m.g_fontset = .T.
  10443.    m.gAShowMe[m.g_tpFileIndx,3] = m.g_dfltfface
  10444.    m.gAShowMe[m.g_tpFileIndx,4] = m.g_dfltfsize
  10445.    m.gAShowMe[m.g_tpFileIndx,5] = m.g_dfltfstyle
  10446. ENDIF
  10447.  
  10448. IF m.g_filetype = c_report AND (_WINDOWS OR _MAC)
  10449.    RELEASE WINDOW transtemp
  10450. ENDIF
  10451.  
  10452. RETURN
  10453.  
  10454. *
  10455. * IS20SCX - Is the current database a 2.0 screen?
  10456. *
  10457. *!*****************************************************************************
  10458. *!
  10459. *!       Function: IS20SCX
  10460. *!
  10461. *!*****************************************************************************
  10462. FUNCTION is20scx
  10463. RETURN (FCOUNT() = c_20scxfld)
  10464. *
  10465. * IS20FRX - Is the current database a 2.0 report?
  10466. *
  10467. *!*****************************************************************************
  10468. *!
  10469. *!       Function: IS20FRX
  10470. *!
  10471. *!*****************************************************************************
  10472. FUNCTION is20frx
  10473. RETURN (FCOUNT() = c_20frxfld)
  10474. *
  10475. * IS20LBX - Is the current database a 2.0 screen?
  10476. *
  10477. *!*****************************************************************************
  10478. *!
  10479. *!       Function: IS20LBX
  10480. *!
  10481. *!*****************************************************************************
  10482. FUNCTION is20lbx
  10483. RETURN (FCOUNT() = c_20lbxfld)
  10484. IF WEXIST("lblwind")   AND WVISIBLE("lblwind")
  10485.    RELEASE WINDOW lblwind
  10486. ENDIF
  10487.  
  10488. *
  10489. * GETSNIPFLAG - See if we are just updating snippets
  10490. *
  10491. *!*****************************************************************************
  10492. *!
  10493. *!       Function: GETSNIPFLAG
  10494. *!
  10495. *!      Called by: UPDATESCREEN       (procedure in TRANSPRT.PRG)
  10496. *!
  10497. *!          Calls: WORDNUM()          (function  in TRANSPRT.PRG)
  10498. *!               : MATCH()            (function  in TRANSPRT.PRG)
  10499. *!
  10500. *!*****************************************************************************
  10501. FUNCTION getsnipflag
  10502. PARAMETER snippet
  10503. PRIVATE m.oldmline, m.retcode
  10504. * Format for directive is "#TRAN SNIPPET ONLY" in setup snippet
  10505. m.oldmline = _MLINE
  10506. m.retcode = .F.
  10507. IF AT('#',snippet) > 0
  10508.    _MLINE = 0
  10509.    m.sniplen = LEN(snippet)
  10510.    DO WHILE _MLINE < m.sniplen
  10511.       m.line = MLINE(snippet,1,_MLINE)
  10512.       m.upline = UPPER(LTRIM(m.line))
  10513.       IF '#TRAN' $ m.upline
  10514.          IF LEFT(wordnum(m.upline,1),5) = '#TRAN' ;
  10515.                AND match(wordnum(m.upline,2),'SNIPPETS') ;
  10516.                AND match(wordnum(m.upline,3),'ONLY')
  10517.             m.retcode = .T.
  10518.          ENDIF
  10519.       ENDIF
  10520.    ENDDO
  10521.    _MLINE = m.oldmline
  10522. ENDIF
  10523. RETURN m.retcode
  10524.  
  10525.  
  10526. *
  10527. * MATCH - Returns TRUE if candidate is a valid 4-or-more-character abbreviation of keyword
  10528. *
  10529. *!*****************************************************************************
  10530. *!
  10531. *!       Function: MATCH
  10532. *!
  10533. *!      Called by: GETSNIPFLAG()      (function  in TRANSPRT.PRG)
  10534. *!
  10535. *!*****************************************************************************
  10536. FUNCTION match
  10537. PARAMETER candidate, keyword
  10538. PRIVATE m.in_exact, m.retval
  10539.  
  10540. m.in_exact = SET("EXACT")
  10541. SET EXACT OFF
  10542. DO CASE
  10543. CASE EMPTY(m.candidate)
  10544.    m.retval = EMPTY(m.keyword)
  10545. CASE LEN(m.candidate) < 4
  10546.    m.retval = IIF(m.candidate == m.keyword,.T.,.F.)
  10547. OTHERWISE
  10548.    m.retval = IIF(m.keyword = m.candidate,.T.,.F.)
  10549. ENDCASE
  10550. IF m.in_exact != "OFF"
  10551.    SET EXACT ON
  10552. ENDIF
  10553. RETURN m.retval
  10554.  
  10555.  
  10556. *
  10557. * WORDNUM - Returns w_num-th word from string strg
  10558. *
  10559. *!*****************************************************************************
  10560. *!
  10561. *!       Function: WORDNUM
  10562. *!
  10563. *!      Called by: GETSNIPFLAG()      (function  in TRANSPRT.PRG)
  10564. *!
  10565. *!*****************************************************************************
  10566. FUNCTION wordnum
  10567. PARAMETERS strg,w_num
  10568. PRIVATE strg,s1,w_num,ret_str
  10569.  
  10570. m.s1 = ALLTRIM(m.strg)
  10571.  
  10572. * Replace tabs with spaces
  10573. m.s1 = CHRTRANC(m.s1,CHR(9)," ")
  10574.  
  10575. * Reduce multiple spaces to a single space
  10576. DO WHILE AT('  ',m.s1) > 0
  10577.    m.s1 = STRTRAN(m.s1,'  ',' ')
  10578. ENDDO
  10579.  
  10580. ret_str = ""
  10581. DO CASE
  10582. CASE m.w_num > 1
  10583.    DO CASE
  10584.    CASE AT(" ",m.s1,m.w_num-1) = 0   && No word w_num.  Past end of string.
  10585.       m.ret_str = ""
  10586.    CASE AT(" ",m.s1,m.w_num) = 0     && Word w_num is last word in string.
  10587.       m.ret_str = SUBSTR(m.s1,AT(" ",m.s1,m.w_num-1)+1,255)
  10588.    OTHERWISE                         && Word w_num is in the middle.
  10589.       m.strt_pos = AT(" ",m.s1,m.w_num-1)
  10590.       m.ret_str  = SUBSTR(m.s1,strt_pos,AT(" ",m.s1,m.w_num)+1 - strt_pos)
  10591.    ENDCASE
  10592. CASE m.w_num = 1
  10593.    IF AT(" ",m.s1) > 0               && Get first word.
  10594.       m.ret_str = SUBSTR(m.s1,1,AT(" ",m.s1)-1)
  10595.    ELSE                              && There is only one word.  Get it.
  10596.       m.ret_str = m.s1
  10597.    ENDIF
  10598. ENDCASE
  10599. RETURN ALLTRIM(m.ret_str)
  10600.  
  10601. *
  10602. * ADDBS - Add a backslash unless there is one already there.
  10603. *
  10604. *!*****************************************************************************
  10605. *!
  10606. *!       Function: ADDBS
  10607. *!
  10608. *!      Called by: FORCEEXT()         (function  in TRANSPRT.PRG)
  10609. *!
  10610. *!*****************************************************************************
  10611. FUNCTION addbs
  10612. * Add a backslash to a path name, if there isn't already one there
  10613. PARAMETER m.pathname
  10614. PRIVATE ALL
  10615. m.pathname = ALLTRIM(UPPER(m.pathname))
  10616. IF !(RIGHT(m.pathname,1) $ '\:') AND !EMPTY(m.pathname)
  10617.    m.pathname = m.pathname + '\'
  10618. ENDIF
  10619. RETURN m.pathname
  10620.  
  10621. *!*****************************************************************************
  10622. *!       Function: JUSTFNAME
  10623. *!*****************************************************************************
  10624. FUNCTION justfname
  10625. *)
  10626. *) JUSTFNAME - Return just the filename (i.e., no path) from "filname"
  10627. *)
  10628. PARAMETERS m.filname
  10629.  
  10630. *- use platform specific path (10/28/95 jd)
  10631. LOCAL clocalfname, cdirsep
  10632. clocalfname = SYS(2027,m.filname)
  10633. cdirsep = IIF(_mac,':','\')
  10634. IF RAT(m.cdirsep ,m.clocalfname) > 0
  10635.    m.clocalfname = SUBSTR(m.clocalfname,RAT(m.cdirsep,m.clocalfname)+1,255)
  10636. ENDIF
  10637. IF AT(':',m.clocalfname) > 0
  10638.    m.clocalfname = SUBSTR(m.clocalfname,AT(':',m.clocalfname)+1,255)
  10639. ENDIF
  10640. RETURN ALLTRIM(m.clocalfname)
  10641.  
  10642.  
  10643. *!*****************************************************************************
  10644. *!       Function: JUSTPATH
  10645. *!*****************************************************************************
  10646. FUNCTION justpath
  10647. *)
  10648. *) JUSTPATH - Returns just the pathname.
  10649. *)
  10650. PARAMETERS m.filname
  10651. m.filname = ALLTRIM(UPPER(m.filname))
  10652. *- use platform specific path (10/28/95 jd)
  10653. LOCAL clocalfname, cdirsep
  10654. clocalfname = SYS(2027,m.filname)
  10655. cdirsep = IIF(_mac,':','\')
  10656. IF m.cdirsep $ m.clocalfname 
  10657.    m.clocalfname = SUBSTR(m.clocalfname,1,RAT(m.cdirsep,m.clocalfname ))
  10658.    IF RIGHT(m.filname,1) = m.cdirsep AND LEN(m.filname) > 1 ;
  10659.             AND SUBSTR(m.clocalfname,LEN(m.clocalfname)-1,1) <> ':'
  10660.          clocalfname= SUBSTR(m.clocalfname,1,LEN(m.clocalfname)-1)
  10661.    ENDIF
  10662.    RETURN m.clocalfname
  10663. ELSE
  10664.    RETURN ''
  10665. ENDIF
  10666.  
  10667. *
  10668. * FORCEEXT - Force filename to have a paricular extension.
  10669. *
  10670. *!*****************************************************************************
  10671. *!
  10672. *!       Function: FORCEEXT
  10673. *!
  10674. *!      Called by: cvrt102FRX()       (function  in TRANSPRT.PRG)
  10675. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  10676. *!
  10677. *!          Calls: JUSTPATH()         (function  in TRANSPRT.PRG)
  10678. *!               : JUSTFNAME()        (function  in TRANSPRT.PRG)
  10679. *!               : ADDBS()            (function  in TRANSPRT.PRG)
  10680. *!
  10681. *!*****************************************************************************
  10682. FUNCTION forceext
  10683. * Force the extension of "filname" to be whatever ext is.
  10684. PARAMETERS m.filname,m.ext
  10685. PRIVATE ALL
  10686. IF SUBSTR(m.ext,1,1) = "."
  10687.    m.ext = SUBSTR(m.ext,2,3)
  10688. ENDIF
  10689.  
  10690. m.pname = justpath(m.filname)
  10691. m.filname = justfname(UPPER(ALLTRIM(m.filname)))
  10692. IF AT('.',m.filname) > 0
  10693.    m.filname = SUBSTR(m.filname,1,AT('.',m.filname)-1) + '.' + m.ext
  10694. ELSE
  10695.    m.filname = m.filname + '.' + m.ext
  10696. ENDIF
  10697. RETURN addbs(m.pname) + m.filname
  10698.  
  10699. *!*****************************************************************************
  10700. *!
  10701. *!       Function: CVTLONG
  10702. *!
  10703. *!          Calls: CVTSHORT()         (function  in TRANSPRT.PRG)
  10704. *!
  10705. *!*****************************************************************************
  10706. FUNCTION cvtlong
  10707. PARAMETER m.itext, m.ioff
  10708. RETURN cvtshort(m.itext,m.ioff) + (65536 * cvtshort(m.itext,m.ioff+2))
  10709.  
  10710. *!*****************************************************************************
  10711. *!
  10712. *!       Function: CVTSHORT
  10713. *!
  10714. *!      Called by: GETOLDREPORTTYPE() (function  in TRANSPRT.PRG)
  10715. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  10716. *!               : CVTLONG()          (function  in TRANSPRT.PRG)
  10717. *!
  10718. *!          Calls: CVTBYTE()          (function  in TRANSPRT.PRG)
  10719. *!
  10720. *!*****************************************************************************
  10721. FUNCTION cvtshort
  10722. PARAMETER m.itext, m.ioff
  10723. RETURN cvtbyte(m.itext,m.ioff) + (256 * cvtbyte(m.itext,m.ioff+1))
  10724.  
  10725. *!*****************************************************************************
  10726. *!
  10727. *!       Function: CVTBYTE
  10728. *!
  10729. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  10730. *!               : CVTSHORT()         (function  in TRANSPRT.PRG)
  10731. *!
  10732. *!*****************************************************************************
  10733. FUNCTION cvtbyte
  10734. PARAMETER m.itext, m.ioff
  10735. RETURN ASC(SUBSTR(m.itext,m.ioff+1,1))
  10736.  
  10737. *!*****************************************************************************
  10738. *!
  10739. *!       Function: OBJ2BASEFONT
  10740. *!
  10741. *!      Called by: FILLININFO         (procedure in TRANSPRT.PRG)
  10742. *!
  10743. *!*****************************************************************************
  10744. FUNCTION obj2basefont
  10745. PARAMETER m.mwidth, m.bfontface, m.bfontsize, m.bfontstyle, m.ofontface, ;
  10746.    m.ofontsize, m.ofontstyle
  10747. * Map a width from one font to another one
  10748. DO CASE
  10749. CASE m.g_char2grph
  10750.    RETURN m.mwidth * FONTMETRIC(6,m.ofontface,m.ofontsize,m.ofontstyle) ;
  10751.       / FONTMETRIC(6,m.bfontface,m.bfontsize,m.bfontstyle)
  10752. CASE m.g_grph2char AND UPPER(m.ofontface) == "MS SANS SERIF" AND ;
  10753.       UPPER(m.bfontface) == "MS SANS SERIF" AND ;
  10754.       m.ofontsize = m.bfontsize AND ;
  10755.       !("B" $ m.ofontstyle) AND ;
  10756.       "B" $ m.bfontstyle
  10757.    * We can't use FONTMETRIC on DOS, so we use heuristics instead.  Most
  10758.    * of the time we will be converting between MS Sans Serif 8 Bold and
  10759.    * MS Sans Serif Regular.  If that is the case here, use the 5/6 conversion
  10760.    * factor that is the relative widths of the chars in these two font styles.
  10761.    RETURN m.mwidth * 5/6
  10762. OTHERWISE
  10763.    RETURN m.mwidth
  10764. ENDCASE
  10765.  
  10766.  
  10767. *!*****************************************************************************
  10768. *!
  10769. *!       Function: VERSIONCAP
  10770. *!
  10771. *!      Called by: RDVALID()          (function  in TRANSPRT.PRG)
  10772. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  10773. *!
  10774. *!*****************************************************************************
  10775. FUNCTION versioncap
  10776. * Map a platform name ("DOS") to its descriptive equivalent ("MS-DOS")
  10777. PARAMETER m.strg
  10778. DO CASE
  10779. CASE strg = c_dosname
  10780.    RETURN "MS-DOS"
  10781. CASE strg = c_winname
  10782.    RETURN "Windows"
  10783. CASE strg = c_macname
  10784.    RETURN "Macintosh"
  10785. CASE strg = c_unixname
  10786.    RETURN c_unixname
  10787. OTHERWISE
  10788.    RETURN strg
  10789. ENDCASE
  10790.  
  10791.  
  10792. *!*****************************************************************************
  10793. *!
  10794. *!       Function: BLACKBOX
  10795. *!
  10796. *!*****************************************************************************
  10797. FUNCTION blackbox
  10798. PARAMETER otype , mred, mblue, mgreen, mpattern
  10799. * Is this a black box?
  10800. IF m.g_grph2char AND m.otype = c_otbox AND ;
  10801.       m.mred = 0 AND m.mblue = 0 AND m.mgreen = 0 ;
  10802.       AND m.mpattern = 0
  10803.    RETURN .T.
  10804. ELSE
  10805.    RETURN .F.
  10806. ENDIF
  10807.  
  10808. *!*****************************************************************************
  10809. *!
  10810. *!      Procedure: SELECTOBJ
  10811. *!
  10812. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  10813. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  10814. *!
  10815. *!          Calls: INITSEL            (procedure in TRANSPRT.PRG)
  10816. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  10817. *!               : ADDSEL             (procedure in TRANSPRT.PRG)
  10818. *!               : VERSIONCAP()       (function  in TRANSPRT.PRG)
  10819. *!               : TPSELECT           (procedure in TRANSPRT.PRG)
  10820. *!
  10821. *!           Uses: M.G_SCRNALIAS
  10822. *!
  10823. *!        Indexes: ID                     (tag)
  10824. *!
  10825. *!*****************************************************************************
  10826. PROCEDURE selectobj
  10827. * Figure out what to transport
  10828. DO initsel
  10829.  
  10830. IF m.g_snippets
  10831.    m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  10832.    SELECT * FROM (m.g_scrnalias) ;
  10833.       WHERE !DELETED() AND platform = m.g_fromplatform ;
  10834.          AND oktransport(comment) ;
  10835.       INTO CURSOR (m.g_tempalias)
  10836.    IF _TALLY > 0
  10837.       INDEX ON uniqueid TAG id
  10838.  
  10839.       SELECT (m.g_scrnalias)
  10840.       SET RELATION TO uniqueid INTO (m.g_tempalias) ADDITIVE
  10841.       LOCATE FOR .T.
  10842.       DO CASE
  10843.       CASE m.g_filetype = c_screen
  10844.          SCAN FOR platform = m.g_toplatform ;
  10845.                AND (INLIST(objtype,C_OBJTYPELIST) OR objtype = c_otheader OR objtype = c_otworkar) ;
  10846.                AND &g_tempalias..timestamp > timestamp
  10847.             DO addsel WITH "Upd"
  10848.          ENDSCAN
  10849.       CASE m.g_filetype = c_report
  10850.          SCAN FOR platform = m.g_toplatform AND ;
  10851.                INLIST(objtype,c_otheader,c_otfield,c_otpicture, ;
  10852.                  c_otrepfld,c_otband,c_otrepvar,c_ottext,c_otline,c_otbox,c_otworkar) ;
  10853.                AND &g_tempalias..timestamp > timestamp
  10854.             DO addsel WITH "Upd"
  10855.          ENDSCAN
  10856.       ENDCASE
  10857.       SELECT (m.g_tempalias)
  10858.       USE
  10859.    ENDIF
  10860.    SELECT (m.g_scrnalias)
  10861. ENDIF
  10862.  
  10863. IF m.g_newobjects
  10864.    m.junk = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  10865.    DO CASE
  10866.    CASE m.g_char2grph
  10867.       SELECT * FROM (m.g_scrnalias) ;
  10868.          WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  10869.          !(objtype = c_otfontdata) AND ;
  10870.          uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  10871.          WHERE platform = m.g_toplatform) ;
  10872.             AND oktransport(comment) ;
  10873.          ORDER BY objtype ;
  10874.          INTO CURSOR (m.junk)
  10875.    CASE m.g_grph2char
  10876.       SELECT * FROM (m.g_scrnalias) ;
  10877.          WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  10878.          !(objtype = c_otband AND INLIST(objcode,2,6)) AND ;
  10879.          !(objtype = c_otpicture) AND ;
  10880.          !(objtype = c_otfontdata) AND ;
  10881.          !blackbox(objtype,fillred,fillblue,fillgreen,fillpat) AND ;
  10882.          uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  10883.          WHERE platform = m.g_toplatform) ;
  10884.             AND oktransport(comment) ;
  10885.          INTO CURSOR (m.junk)
  10886.    CASE m.g_grph2grph
  10887.       SELECT * FROM (m.g_scrnalias) ;
  10888.          WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  10889.          uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  10890.          WHERE platform = m.g_toplatform) ;
  10891.             AND oktransport(comment) ;
  10892.          ORDER BY objtype ;
  10893.          INTO CURSOR (m.junk)
  10894.    ENDCASE
  10895.    IF _TALLY > 0
  10896.       SCAN
  10897.          DO addsel WITH "New"
  10898.       ENDSCAN
  10899.       USE  && discard the cursor
  10900.    ENDIF
  10901. ENDIF
  10902.  
  10903. IF m.g_tpselcnt > 0   && This variable is incremented in addsel()
  10904.    m.tpcancel = 1
  10905.  
  10906.    IF m.gAShowMe[m.g_tpFileIndx,1]
  10907.       * Prompt user to designate at any items he does not want transported
  10908.       DO tpselect WITH tparray, m.tpcancel,versioncap(m.g_fromplatform),versioncap(m.g_toplatform)
  10909.    ELSE
  10910.       m.tpcancel = 1   && pretend like the OK button was pressed
  10911.    ENDIF
  10912.  
  10913.    DO CASE
  10914.    CASE m.tpcancel = 1   && user pressed OK, so let's get to it.
  10915.    CASE m.tpcancel = 2   && user pressed "cancel" on the selection dialog.
  10916.       m.g_status = 3
  10917.       m.g_returncode = c_cancel
  10918.       RETURN TO transprt
  10919.    CASE m.tpcancel > 2
  10920.       * There aren't any objects that qualify for transporting.  User deselected all of them.
  10921.       * Pretend like we're done.
  10922.       m.g_status = 3
  10923.       m.g_returncode = c_yes
  10924.       RETURN TO transprt
  10925.    ENDCASE
  10926. ELSE
  10927.    * There aren't any objects that qualify for transporting.
  10928.    * Pretend like we're done.
  10929.    m.g_status = 3
  10930.    m.g_returncode = c_yes
  10931.    RETURN TO transprt
  10932. ENDIF
  10933.  
  10934. RETURN
  10935.  
  10936. *!*****************************************************************************
  10937. *!
  10938. *!      Procedure: INITSEL
  10939. *!
  10940. *!      Called by: SELECTOBJ          (procedure in TRANSPRT.PRG)
  10941. *!
  10942. *!*****************************************************************************
  10943. PROCEDURE initsel
  10944. * Initialize the tparray selection array
  10945. m.g_tpselcnt = 0
  10946. RETURN
  10947.  
  10948. *!*****************************************************************************
  10949. *!
  10950. *!      Procedure: ADDSEL
  10951. *!
  10952. *!      Called by: SELECTOBJ          (procedure in TRANSPRT.PRG)
  10953. *!
  10954. *!          Calls: ASSEMBLE()         (function  in TRANSPRT.PRG)
  10955. *!
  10956. *!*****************************************************************************
  10957. PROCEDURE addsel
  10958. PARAMETER STATUS
  10959. * Don't use RECCOUNT() here since the open "database" will often be a cursor.
  10960. IF _WINDOWS OR _MAC
  10961.    m.g_tpselcnt = m.g_tpselcnt + 1
  10962.    DIMENSION tparray[m.g_tpselcnt,3]
  10963.    tparray[m.g_tpselcnt,1] = m.g_checkmark+' '+assemble(STATUS)
  10964.    tparray[m.g_tpselcnt,2] = uniqueid
  10965.    tparray[m.g_tpselcnt,3] = objtype
  10966.  
  10967. ELSE
  10968.    m.g_tpselcnt = m.g_tpselcnt + 1
  10969.    DIMENSION tparray[m.g_tpselcnt,3]
  10970.    tparray[m.g_tpselcnt,1] = m.g_checkmark+' '+assemble(STATUS)
  10971.    tparray[m.g_tpselcnt,2] = uniqueid
  10972.    tparray[m.g_tpselcnt,3] = objtype
  10973. ENDIF
  10974. RETURN
  10975.  
  10976. *!*****************************************************************************
  10977. *!
  10978. *!       Function: ISSELECTED
  10979. *!
  10980. *!*****************************************************************************
  10981. FUNCTION isselected
  10982. * Returns .T. if this uniqueid passed in idnum corresponds to an item
  10983. * marked on the tparray list.
  10984. PARAMETER idnum,mobjtype, mobjcode
  10985. DO CASE
  10986. CASE m.mobjtype = c_otfontdata
  10987.    RETURN .T.
  10988. OTHERWISE
  10989.    m.pos = ASCAN(tparray,m.idnum)
  10990.    IF m.pos > 0
  10991.       * Check pos-1 since this is a two dimensional array.  ASCAN returns an element number
  10992.       * but we are really interested in the column before the one that the match took place in.
  10993.       RETURN IIF(LEFT(tparray[m.pos-1],1) <> ' ',.T.,.F.)
  10994.    ELSE
  10995.       RETURN .F.
  10996.    ENDIF
  10997. ENDCASE
  10998.  
  10999. *!*****************************************************************************
  11000. *!
  11001. *!       Function: ASSEMBLE
  11002. *!
  11003. *!      Called by: ADDSEL             (procedure in TRANSPRT.PRG)
  11004. *!
  11005. *!          Calls: TYPE2NAME()        (function  in TRANSPRT.PRG)
  11006. *!               : CLEANPICT()        (function  in TRANSPRT.PRG)
  11007. *!
  11008. *!*****************************************************************************
  11009. FUNCTION assemble
  11010. * Form the string used for user selection of objects to transport
  11011. PARAMETER statstrg
  11012. PRIVATE m.strg
  11013. DO CASE
  11014. CASE INLIST(objtype,c_ottxtbut,c_otradbut,c_otchkbox)
  11015.    m.strg = PADR(statstrg,5);
  11016.       + PADR(type2name(objtype),15) ;
  11017.       + PADR(name,15) ;
  11018.       + PADR(cleanpict(PICTURE),30)
  11019. CASE objtype = c_otfield AND EMPTY(name)    && it's a SAY expression
  11020.    m.strg = PADR(statstrg,5);
  11021.       + PADR(type2name(objtype),15) ;
  11022.       + PADR(expr,45)
  11023. CASE INLIST(objtype,c_otbox,c_otline)
  11024.    DO CASE
  11025.    CASE m.g_char2grph OR m.g_grph2grph
  11026.       m.strg = PADR(statstrg,5);
  11027.          + PADR(type2name(objtype),15) ;
  11028.          + PADR("",15) ;
  11029.          + PADR("From "+ALLTRIM(STR(vpos,3))+","+ALLTRIM(STR(hpos,3))+" to " ;
  11030.          + ALLTRIM(STR(vpos+HEIGHT,3))+","+ALLTRIM(STR(hpos+WIDTH,3)),45)
  11031.    CASE m.g_grph2char
  11032.       m.strg = PADR(statstrg,5);
  11033.          + PADR(type2name(objtype),15) ;
  11034.          + PADR("",15) ;
  11035.          + PADR("At: " ;
  11036.          + ALLTRIM(STR(ROUND(cvtreportvertical(vpos),0),3));
  11037.          + ",";
  11038.          + ALLTRIM(STR(ROUND(cvtreportvertical(hpos),0),3));
  11039.          + ", Height: ";
  11040.          + ALLTRIM(STR(ROUND(cvtreportvertical(height),0),3));
  11041.          + ", Width: " ;
  11042.          + ALLTRIM(STR(ROUND(cvtreportvertical(width),0),3)),45)
  11043.    ENDCASE
  11044. OTHERWISE
  11045.    m.strg = PADR(statstrg,5);
  11046.       + PADR(type2name(objtype),15) ;
  11047.       + PADR(name,15) ;
  11048.       + PADR(expr,30)
  11049. ENDCASE
  11050.  
  11051. IF _WINDOWS OR _MAC
  11052.    RETURN LEFT(m.strg,5) + ansitooem(RIGHT(m.strg,LEN(m.strg)-5))
  11053. ELSE
  11054.    RETURN m.strg
  11055. ENDIF
  11056. *!*****************************************************************************
  11057. *!
  11058. *!       Function: TYPE2NAME
  11059. *!
  11060. *!      Called by: ASSEMBLE()         (function  in TRANSPRT.PRG)
  11061. *!
  11062. *!*****************************************************************************
  11063. FUNCTION type2name
  11064. PARAMETER N
  11065. PRIVATE strg
  11066. DO CASE
  11067. CASE m.n = c_otheader
  11068.    m.strg = "Header"
  11069. CASE INLIST(m.n,c_otworkar,c_otindex,c_otrel)
  11070.    m.strg = "Environment"
  11071. CASE m.n = c_ottext
  11072.    m.strg = "Text"
  11073. CASE m.n = c_otline
  11074.    m.strg = "Line"
  11075. CASE m.n = c_otbox
  11076.    m.strg = "Box"
  11077. CASE m.n = c_otrepfld
  11078.    m.strg = "Report field"
  11079. CASE m.n = c_otband
  11080.    m.strg = "Band"
  11081. CASE m.n = c_otgroup
  11082.    m.strg = "Group"
  11083. CASE m.n = c_otlist
  11084.    m.strg = "List"
  11085. CASE m.n = c_ottxtbut
  11086.    m.strg = "Push button"
  11087. CASE m.n = c_otradbut
  11088.    m.strg = "Radio button"
  11089. CASE m.n = c_otchkbox
  11090.    m.strg = "Check box"
  11091. CASE m.n = c_otfield
  11092.    DO CASE
  11093.    CASE EMPTY(name)
  11094.       IF !EMPTY(expr)
  11095.          m.strg = T_SEXPR_LOC
  11096.       ELSE
  11097.          m.strg = T_FIELD_LOC
  11098.       ENDIF
  11099.    CASE EMPTY(expr)
  11100.       m.strg = T_GFIELD_LOC
  11101.    OTHERWISE
  11102.       m.strg = T_FIELD_LOC
  11103.    ENDCASE
  11104. CASE m.n = c_otpopup
  11105.    m.strg = T_POPUP_LOC
  11106. CASE m.n = c_otpicture
  11107.    m.strg = "Picture"
  11108. CASE m.n = c_otrepvar
  11109.    m.strg = T_RPTVAR_LOC
  11110. CASE m.n = c_otinvbut
  11111.    m.strg = T_INVBTN_LOC
  11112. CASE m.n = c_otspinner
  11113.    m.strg = T_SPIN_LOC
  11114. CASE m.n = c_otpdset
  11115.    m.strg = T_PDRIVER_LOC 
  11116. CASE m.n = c_otfontdata
  11117.    m.strg = T_FONTDATA_LOC 
  11118. OTHERWISE
  11119.    m.strg = STR(objtype,4)
  11120. ENDCASE
  11121.  
  11122. RETURN m.strg
  11123.  
  11124.  
  11125. *!*****************************************************************************
  11126. *!
  11127. *!       Function: CLEANPICT
  11128. *!
  11129. *!      Called by: ASSEMBLE()         (function  in TRANSPRT.PRG)
  11130. *!
  11131. *!*****************************************************************************
  11132. FUNCTION cleanpict
  11133. PARAMETER m.strg
  11134. PRIVATE m.atsign
  11135.  
  11136. * Drop quotation marks
  11137. IF AT(LEFT(m.strg,1),CHR(34)+CHR(39)) > 0
  11138.    m.strg = SUBSTR(m.strg,2)
  11139. ENDIF
  11140. IF AT(RIGHT(m.strg,1),CHR(34)+CHR(39)) > 0
  11141.    m.strg = SUBSTR(m.strg,1,LEN(m.strg)-1)
  11142. ENDIF
  11143.  
  11144. m.atsign = AT("@",m.strg)
  11145. IF m.atsign > 0
  11146.    m.strg = LTRIM(SUBSTR(m.strg,m.atsign+AT(' ',SUBSTR(m.strg,m.atsign))))
  11147. ENDIF
  11148.  
  11149. IF LEN(m.strg) > 30
  11150.    m.strg = LEFT(m.strg,27) + '...'
  11151. ENDIF
  11152. RETURN m.strg
  11153.  
  11154.  
  11155. *!*****************************************************************************
  11156. *!
  11157. *!      Procedure: TPSELECT
  11158. *!
  11159. *!      Called by: SELECTOBJ          (procedure in TRANSPRT.PRG)
  11160. *!
  11161. *!          Calls: TOGGLE()           (function  in TRANSPRT.PRG)
  11162. *!               : OKVALID()          (function  in TRANSPRT.PRG)
  11163. *!               : WREADDEAC()        (function  in TRANSPRT.PRG)
  11164. *!
  11165. *!*****************************************************************************
  11166. PROCEDURE tpselect
  11167. PARAMETERS tparray, tpcancel, fromplat,toplat
  11168. DO CASE
  11169. CASE m.g_snippets AND m.g_newobjects
  11170.    ptext = T_OBJNEW1_LOC + m.toplat + T_OBJNEW2_LOC + m.fromplat+"."
  11171. CASE m.g_newobjects
  11172.    ptext = T_OBJNEW1_LOC + m.toplat + "."
  11173. CASE m.g_snippets 
  11174.    ptext = T_OBJMOD_LOC + m.fromplat + "."
  11175. ENDCASE
  11176.  
  11177. DO CASE
  11178. CASE _WINDOWS
  11179.    IF NOT WEXIST("tpselect")
  11180.       DEFINE WINDOW tpselect ;
  11181.          AT  0.000, 0.000  ;
  11182.          SIZE 25.538,116.000 ;
  11183.          TITLE T_TITLE_LOC  ;
  11184.          FONT m.g_smface, m.g_smsize ;
  11185.          FLOAT ;
  11186.          CLOSE ;
  11187.          NOMINIMIZE ;
  11188.          DOUBLE ;
  11189.          COLOR RGB(0,0,0,192,192,192)
  11190.       MOVE WINDOW tpselect CENTER
  11191.    ENDIF
  11192.    IF WVISIBLE("tpselect")
  11193.       ACTIVATE WINDOW tpselect SAME
  11194.    ELSE
  11195.       ACTIVATE WINDOW tpselect NOSHOW
  11196.    ENDIF
  11197.    @ 6.769,2.400 TO 8.154,113.000 ;
  11198.       PATTERN 1 ;
  11199.       PEN 1, 8 ;
  11200.       COLOR RGB(,,,192,192,192)
  11201.    @ 8.154,2.600 GET xsel ;
  11202.       PICTURE "@&N" ;
  11203.       FROM tparray ;
  11204.       SIZE 17.500,68.875 ;
  11205.       DEFAULT 1 ;
  11206.       FONT m.g_foxfont, m.g_foxfsize ;
  11207.       VALID toggle()
  11208.    @ 1.462,3.000 SAY ptext ;
  11209.       SIZE 4.000,33.833 ;
  11210.       FONT m.g_smface, m.g_smsize ;
  11211.       STYLE "B"
  11212.    @ 1.462,50.400 SAY T_UNCHECK1_LOC  ;
  11213.       SIZE 1.000,28.000, 0.000 ;
  11214.       FONT m.g_smface, m.g_smsize ;
  11215.       STYLE "BT"
  11216.    @ 2.385,50.200 SAY T_UNCHECK2_LOC ;
  11217.       SIZE 1.000,4.167, 0.000 ;
  11218.       FONT m.g_smface, m.g_smsize ;
  11219.       STYLE "BIT"
  11220.    @ 2.385,55.000 SAY T_UNCHECK3_LOC  ;
  11221.       SIZE 1.000,27.000, 0.000 ;
  11222.       FONT m.g_smface, m.g_smsize ;
  11223.       STYLE "BT"
  11224.    @ 0.923,93.600 GET tpcancel ;
  11225.       PICTURE "@*VT \!\<"+T_OK_LOC+";\?\<"+T_CANCEL_LOC ;
  11226.       SIZE 1.846,16.333,0.308 ;
  11227.       DEFAULT 1 ;
  11228.       FONT m.g_tdlgface, m.g_tdlgsize ;
  11229.       STYLE m.g_tdlgstyle ;
  11230.       VALID okvalid()
  11231.    @ 6.923,5.800 SAY T_STAT_LOC  ;
  11232.       SIZE 1.000,5.000, 0.000 ;
  11233.       FONT m.g_smface, m.g_smsize ;
  11234.       STYLE "BT"
  11235.    @ 6.923,14.000 SAY T_TYPE_LOC  ;
  11236.       SIZE 1.000,6.000, 0.000 ;
  11237.       FONT m.g_smface, m.g_smsize ;
  11238.       STYLE "BT"
  11239.    @ 6.923,38.200 SAY T_VARIABLE_LOC  ;
  11240.       SIZE 1.000,10.000, 0.000 ;
  11241.       FONT m.g_smface, m.g_smsize ;
  11242.       STYLE "BT"
  11243.    @ 6.923,62.000 SAY T_EXPPROMPT_LOC  ;
  11244.       SIZE 1.000,25.000, 0.000 ;
  11245.       FONT m.g_smface, m.g_smsize ;
  11246.       STYLE "BT"
  11247.  
  11248.    IF NOT WVISIBLE("tpselect")
  11249.       ACTIVATE WINDOW tpselect
  11250.    ENDIF
  11251.  
  11252.    READ CYCLE;
  11253.       MODAL;
  11254.       DEACTIVATE wreaddeac()
  11255.  
  11256.    RELEASE WINDOW tpselect
  11257. CASE _MAC
  11258.    IF NOT WEXIST("tpselect")
  11259.       DEFINE WINDOW tpselect ;
  11260.          AT  0.000, 0.000  ;
  11261.          SIZE 25.538,100.000 ;
  11262.          TITLE T_TITLE_LOC  ;
  11263.          FONT "Geneva",9 ;
  11264.             STYLE "" ;
  11265.          FLOAT ;
  11266.          CLOSE ;
  11267.          NOMINIMIZE ;
  11268.          DOUBLE
  11269.       MOVE WINDOW tpselect CENTER
  11270.    ENDIF
  11271.    IF WVISIBLE("tpselect")
  11272.       ACTIVATE WINDOW tpselect SAME
  11273.    ELSE
  11274.       ACTIVATE WINDOW tpselect NOSHOW
  11275.    ENDIF
  11276.    *@ 6.769,2.400 TO 8.154,97.800 ;
  11277.    *   PATTERN 1 ;
  11278.    *   PEN 1, 8 ;
  11279.    *   COLOR RGB(,,,192,192,192)
  11280.    @ 8.154,2.600 GET xsel ;
  11281.       PICTURE "@&N" ;
  11282.       FROM tparray ;
  11283.       SIZE 16.000,78.875 ;
  11284.       DEFAULT 1 ;
  11285.       FONT m.g_foxfont, m.g_foxfsize ;
  11286.       VALID toggle()
  11287.    @ 1.462,3.000 SAY ptext ;
  11288.       SIZE 4.000,33.833 ;
  11289.       FONT "Geneva", 9 ;
  11290.       STYLE m.g_smsty1
  11291.    @ 1.462,50.400 SAY T_UNCHECK1_LOC  ;
  11292.       SIZE 1.000,28.000, 0.000 ;
  11293.       FONT "Geneva", 9 ;
  11294.       STYLE ""
  11295.    @ 2.385,50.200 SAY T_UNCHECK2_LOC  ;
  11296.       SIZE 1.000,4.167, 0.000 ;
  11297.       FONT "Geneva", 9 ;
  11298.       STYLE ""+"I"
  11299.    @ 2.385,54.000 SAY T_UNCHECK3_LOC  ;
  11300.       SIZE 1.000,27.000, 0.000 ;
  11301.       FONT "Geneva", 9 ;
  11302.       STYLE ""
  11303.    @ 0.923,83.600 GET tpcancel ;
  11304.       PICTURE "@*VT \!\<"+T_OK_LOC+";\?\<"+T_CANCEL_LOC ;
  11305.       SIZE m.g_tdlgbtn,10.000,0.500 ;
  11306.       DEFAULT 1 ;
  11307.       FONT m.g_tdlgface, m.g_tdlgsize ;
  11308.       STYLE m.g_tdlgstyle ;
  11309.       VALID okvalid()
  11310.    @ 6.923,5.550 SAY T_STAT_LOC  ;
  11311.       SIZE 1.000,5.000, 0.000 ;
  11312.       FONT "Geneva", 9 ;
  11313.       STYLE "TB"
  11314.    @ 6.923,11.500 SAY T_TYPE_LOC  ;
  11315.       SIZE 1.000,5.500, 0.000 ;
  11316.       FONT "Geneva", 9 ;
  11317.       STYLE "TB"
  11318.    @ 6.923,29.200 SAY T_VARIABLE_LOC  ;
  11319.       SIZE 1.000,10.000, 0.000 ;
  11320.       FONT "Geneva", 9 ;
  11321.       STYLE "TB"
  11322.    @ 6.923,47.500 SAY T_EXPPROMPT_LOC  ;
  11323.       SIZE 1.000,25.000, 0.000 ;
  11324.       FONT "Geneva", 9 ;
  11325.       STYLE "TB"
  11326.  
  11327.    IF NOT WVISIBLE("tpselect")
  11328.       ACTIVATE WINDOW tpselect
  11329.    ENDIF
  11330.  
  11331.    READ CYCLE;
  11332.       MODAL;
  11333.       DEACTIVATE wreaddeac()
  11334.  
  11335.    RELEASE WINDOW tpselect
  11336. CASE _DOS
  11337.    IF NOT WEXIST("tpselect")
  11338.       DEFINE WINDOW tpselect ;
  11339.          FROM INT((SROW()-23)/2),INT((SCOL()-77)/2) ;
  11340.          TO INT((SROW()-23)/2)+22,INT((SCOL()-77)/2)+76 ;
  11341.          TITLE T_TITLE_LOC  ;
  11342.          FLOAT ;
  11343.          CLOSE ;
  11344.          NOMINIMIZE ;
  11345.          DOUBLE ;
  11346.          COLOR SCHEME 5
  11347.    ENDIF
  11348.    IF WVISIBLE("tpselect")
  11349.       ACTIVATE WINDOW tpselect SAME
  11350.    ELSE
  11351.       ACTIVATE WINDOW tpselect NOSHOW
  11352.    ENDIF
  11353.    @ 0,0 CLEAR
  11354.    @ 8,1 GET xsel ;
  11355.       PICTURE "@&N" ;
  11356.       FROM tparray ;
  11357.       SIZE 13,72 ;
  11358.       DEFAULT 1 ;
  11359.       VALID toggle() ;
  11360.       COLOR SCHEME 6
  11361.    @ 1,30 SAY T_UNCHECK1_LOC  ;
  11362.       SIZE 1,24, 0
  11363.    @ 2,30 SAY T_UNCHECK2_LOC  ;
  11364.       SIZE 1,3, 0
  11365.    @ 2,34 SAY T_UNCHECK3_LOC  ;
  11366.       SIZE 1,23, 0
  11367.    @ 1,62 GET tpcancel ;
  11368.       PICTURE "@*VT \!\<"+T_OK_LOC+";\?\<"+T_CANCEL_LOC ;
  11369.       SIZE 1,10,0 ;
  11370.       DEFAULT 1 ;
  11371.       VALID okvalid()
  11372.    @ 7,10 SAY T_TYPE_LOC  ;
  11373.       SIZE 1,4, 0
  11374.    @ 7,40 SAY T_EXPPROMPT_LOC  ;
  11375.       SIZE 1,17, 0
  11376.    @ 7,25 SAY T_VARIABLE_LOC  ;
  11377.       SIZE 1,8, 0
  11378.    @ 7,5 SAY T_STAT_LOC  ;
  11379.       SIZE 1,4, 0
  11380.    @ 1,2 SAY ptext ;
  11381.       SIZE 5,26
  11382.  
  11383.    IF NOT WVISIBLE("tpselect")
  11384.       ACTIVATE WINDOW tpselect
  11385.    ENDIF
  11386.  
  11387.    READ CYCLE ;
  11388.       MODAL ;
  11389.       DEACTIVATE wreaddeac()
  11390.  
  11391.    RELEASE WINDOW tpselect
  11392. ENDCASE
  11393.  
  11394. *!*****************************************************************************
  11395. *!
  11396. *!       Function: TOGGLE
  11397. *!
  11398. *!      Called by: TPSELECT           (procedure in TRANSPRT.PRG)
  11399. *!
  11400. *!*****************************************************************************
  11401. FUNCTION toggle
  11402. * Toggle mark
  11403. IF LEFT(tparray[xsel,1],1) <> ' '
  11404.    tparray[xsel,1] = STUFF(tparray[xsel,1],1,1,' ')
  11405. ELSE
  11406.    tparray[xsel,1] = STUFF(tparray[xsel,1],1,1,m.g_checkmark)
  11407. ENDIF
  11408. SHOW GETS
  11409. RETURN .F.
  11410.  
  11411. *!*****************************************************************************
  11412. *!
  11413. *!       Function: OKVALID
  11414. *!
  11415. *!      Called by: TPSELECT           (procedure in TRANSPRT.PRG)
  11416. *!
  11417. *!*****************************************************************************
  11418. FUNCTION okvalid
  11419. * Simulate a cancel if no objects were selected.
  11420. IF tpcancel = 1
  11421.    PRIVATE m.i
  11422.    m.cnt = 0
  11423.    FOR m.i = 1 TO m.g_tpselcnt
  11424.       IF LEFT(tparray[m.i,1],1) <> ' '
  11425.          m.cnt = m.cnt + 1
  11426.       ENDIF
  11427.    ENDFOR
  11428.    IF m.cnt = 0
  11429.       m.tpcancel = 3   && code that means, "just open as is."
  11430.    ENDIF
  11431. ENDIF
  11432.  
  11433. *!*****************************************************************************
  11434. *!
  11435. *!       Function: WREADDEAC
  11436. *!
  11437. *!      Called by: TPSELECT           (procedure in TRANSPRT.PRG)
  11438. *!
  11439. *!*****************************************************************************
  11440. FUNCTION wreaddeac
  11441. *
  11442. * Deactivate Code from screen: TP
  11443. *
  11444. CLEAR READ
  11445.  
  11446. *!*****************************************************************************
  11447. *!
  11448. *!       Function: EnvSelect
  11449. *!
  11450. *!*****************************************************************************
  11451. FUNCTION EnvSelect
  11452. PRIVATE m.i
  11453. * Was an environment record selected for transport?
  11454. FOR m.i = 1 TO m.g_tpselcnt
  11455.    IF IsEnviron(tparray[m.i,3]) AND LEFT(tparray[m.i,1],1) <> " "
  11456.       RETURN .T.
  11457.    ENDIF
  11458. ENDFOR
  11459. RETURN .F.
  11460.  
  11461. *!*****************************************************************************
  11462. *!
  11463. *!       Function: OutputOrd
  11464. *!
  11465. *!*****************************************************************************
  11466. FUNCTION outputord
  11467. PARAMETER m.otype, m.rno
  11468. * Function to sort screen and report files.  We want the header and environment
  11469. * records to be at the "top" of the platform, and other records to be in their
  11470. * original order.
  11471. IF objtype <= 4
  11472.    RETURN STR(m.otype,3)+STR(m.rno,3)
  11473. ELSE
  11474.    RETURN STR(m.rno,3)+STR(m.otype,3)
  11475. ENDIF
  11476.  
  11477. *!*****************************************************************************
  11478. *!
  11479. *!       Procedure: PUTWINMSG
  11480. *!
  11481. *!*****************************************************************************
  11482. PROCEDURE putwinmsg
  11483. PARAMETER m.msg
  11484. IF _WINDOWS OR _MAC
  11485.    SET MESSAGE TO m.msg
  11486. ENDIF
  11487.  
  11488. *
  11489. * SETALL - Create program's environment.
  11490. *
  11491. * Description:
  11492. * Save the user's environment that is being modified by the GENSCRN,
  11493. * then issue various SET commands.
  11494. *
  11495. *!*****************************************************************************
  11496. *!
  11497. *!      Procedure: SETALL
  11498. *!
  11499. *!      Called by: TRANSPRT.PRG
  11500. *!
  11501. *!          Calls: ESCHANDLER         (procedure in TRANSPRT.PRG)
  11502. *!
  11503. *!*****************************************************************************
  11504. PROCEDURE setall
  11505.  
  11506. *-CLEAR PROGRAM
  11507. CLEAR GETS
  11508.  
  11509. m.escape = SET("ESCAPE")
  11510. *SET ESCAPE ON
  11511.  
  11512. *m.onescape = ON("ESCAPE")
  11513. *ON ESCAPE DO eschandler
  11514.  
  11515. *SET ESCAPE OFF
  11516. m.trbetween = SET("TRBET")
  11517. SET TRBET OFF
  11518. m.comp = SET("COMPATIBLE")
  11519. SET COMPATIBLE FOXPLUS
  11520. m.device = SET("DEVICE")
  11521. SET DEVICE TO SCREEN
  11522.  
  11523. m.rbord = SET("READBORDER")
  11524. SET READBORDER ON
  11525.  
  11526. m.status = SET("STATUS")
  11527. *SET STATUS OFF
  11528.  
  11529. m.currarea = SELECT()
  11530.  
  11531. m.udfparms = SET('UDFPARMS')
  11532. SET UDFPARMS TO VALUE
  11533.  
  11534. m.mtopic = SET("TOPIC")
  11535. IF SET("HELP") = "ON"
  11536.    DO CASE
  11537.    CASE ATC(".DBF",SET("HELP",1)) > 0
  11538.       SET TOPIC TO CHR(254)+" Transporter"
  11539.       ON KEY LABEL F1 HELP ■ Transporter
  11540.    CASE ATC(".HLP",SET("HELP",1)) > 0
  11541.       SET TOPIC TO Transporter Dialog
  11542.       ON KEY LABEL F1 HELP Transporter Dialog
  11543.    ENDCASE
  11544. ENDIF
  11545.  
  11546. m.mfieldsto = SET("FIELDS",1)
  11547. m.fields = SET("FIELDS")
  11548. SET FIELDS TO
  11549. SET FIELDS OFF
  11550.  
  11551. m.memowidth = SET("MEMOWIDTH")
  11552. SET MEMOWIDTH TO 256
  11553.  
  11554. m.cursor = SET("CURSOR")
  11555. SET CURSOR OFF
  11556.  
  11557. m.consol = SET("CONSOLE")
  11558. SET CONSOLE OFF
  11559.  
  11560. m.bell = SET("BELL")
  11561. SET BELL OFF
  11562.  
  11563. m.exact = SET("EXACT")
  11564. SET EXACT ON
  11565.  
  11566. m.deci = SET("DECIMALS")
  11567. SET DECIMALS TO 10
  11568.  
  11569. m.fixed = SET("FIXED")
  11570. SET FIXED ON
  11571.  
  11572. m.print = SET("PRINT")
  11573. SET PRINT OFF
  11574.  
  11575. m.unqset = SET("UNIQUE")
  11576. SET UNIQUE OFF
  11577.  
  11578. m.safety = SET("SAFETY")
  11579. SET SAFETY OFF
  11580.  
  11581. m.exclusive = SET("EXCLUSIVE")
  11582. SET EXCLUSIVE ON
  11583.  
  11584. IF versnum() > "2.5"
  11585.    m.mcollate = SET("COLLATE")
  11586.    SET COLLATE TO "machine"
  11587. ENDIF
  11588.  
  11589. #if "MAC" $ UPPER(VERSION(1))
  11590.    IF _MAC
  11591.       m.mmacdesk = SET("MACDESKTOP")
  11592.       SET MACDESKTOP ON
  11593.    ENDIF
  11594. #endif
  11595.  
  11596. *
  11597. * CLEANUP - Restore environment to pre-execution state.
  11598. *
  11599. * Description:
  11600. * Put SET command settings back the way we found them.
  11601. *
  11602. *!*****************************************************************************
  11603. *!
  11604. *!      Procedure: CLEANUP
  11605. *!
  11606. *!      Called by: TRANSPRT.PRG
  11607. *!               : ERRORHANDLER       (procedure in TRANSPRT.PRG)
  11608. *!               : CONVERTTYPE()      (function  in TRANSPRT.PRG)
  11609. *!               : ESCHANDLER         (procedure in TRANSPRT.PRG)
  11610. *!
  11611. *!          Calls: WRITERESULT        (procedure in TRANSPRT.PRG)
  11612. *!               : DEACTTHERM         (procedure in TRANSPRT.PRG)
  11613. *!
  11614. *!*****************************************************************************
  11615. PROCEDURE cleanup
  11616.  
  11617. PARAMETER m.cancafter
  11618. IF PARAMETERS() = 0
  11619.    m.cancafter = .F.
  11620. ENDIF
  11621. IF NOT EMPTY(m.g_20alias)
  11622.    IF m.g_status != 0
  11623.       IF USED(m.g_tempalias)
  11624.          SELECT (m.g_tempalias)
  11625.          USE
  11626.       ENDIF
  11627.       IF USED(m.g_fromobjonlyalias)
  11628.          SELECT (m.g_fromobjonlyalias)
  11629.          USE
  11630.       ENDIF
  11631.       IF USED(m.g_boxeditemsalias)
  11632.          SELECT (m.g_boxeditemsalias)
  11633.          USE
  11634.       ENDIF
  11635.       SELECT (m.g_20alias)
  11636.       USE
  11637.       SELECT (m.g_scrnalias)
  11638.    ELSE
  11639.       DO writeresult   && updates thermometer too
  11640.    ENDIF
  11641. ENDIF
  11642.  
  11643. ON ERROR &onerror
  11644. *ON ESCAPE &onescape
  11645.  
  11646. IF m.consol = "ON"
  11647.    SET CONSOLE ON
  11648. ELSE
  11649.    SET CONSOLE OFF
  11650. ENDIF
  11651.  
  11652. IF m.escape = "ON"
  11653.    SET ESCAPE ON
  11654. ELSE
  11655.    SET ESCAPE OFF
  11656. ENDIF
  11657.  
  11658. IF m.bell = "ON"
  11659.    SET BELL ON
  11660. ELSE
  11661.    SET BELL OFF
  11662. ENDIF
  11663.  
  11664. SET FIELDS TO &mfieldsto
  11665. IF m.fields = "ON"
  11666.        SET FIELDS ON
  11667. ELSE
  11668.        SET FIELDS OFF
  11669. ENDIF
  11670.  
  11671. IF m.exact = "ON"
  11672.    SET EXACT ON
  11673. ELSE
  11674.    SET EXACT OFF
  11675. ENDIF
  11676.  
  11677. IF m.comp = "ON"
  11678.    SET COMPATIBLE ON
  11679. ENDIF
  11680.  
  11681. IF m.print = "ON"
  11682.    SET PRINT ON
  11683. ENDIF
  11684.  
  11685. IF m.fixed = "OFF"
  11686.    SET FIXED OFF
  11687. ENDIF
  11688.  
  11689. IF m.trbetween = "ON"
  11690.    SET TRBET ON
  11691. ENDIF
  11692.  
  11693. IF m.unqset = "ON"
  11694.    SET UNIQUE ON
  11695. ENDIF
  11696.  
  11697. IF m.rbord = "OFF"
  11698.    SET READBORDER OFF
  11699. ENDIF
  11700.  
  11701. IF m.status = "ON"
  11702.    SET STATUS ON
  11703. ENDIF
  11704.  
  11705. SET DECIMALS TO m.deci
  11706. SET MEMOWIDTH TO m.memowidth
  11707. SET DEVICE TO &device
  11708. SET UDFPARMS TO &udfparms
  11709. SET TOPIC TO &mtopic
  11710.  
  11711. IF versnum() > "2.5"
  11712.    SET COLLATE TO "&mcollate"
  11713. ENDIF
  11714.  
  11715. #if "MAC" $ UPPER(VERSION(1))
  11716.    IF _MAC
  11717.       SET MACDESKTOP &mmacdesk
  11718.     ENDIF
  11719. #endif
  11720.  
  11721. ON KEY LABEL F1
  11722. POP KEY
  11723.  
  11724. USE
  11725. DELETE FILE (m.g_tempindex)
  11726. SET MESSAGE TO
  11727.  
  11728. SELECT (m.currarea)
  11729.  
  11730. DO deacttherm
  11731.  
  11732. IF m.cursor = "ON"
  11733.    SET CURSOR ON
  11734. ELSE
  11735.    SET CURSOR OFF
  11736. ENDIF
  11737.  
  11738. IF m.safety = "ON"
  11739.    SET SAFETY ON
  11740. ENDIF
  11741.  
  11742. IF m.talkset = "ON"
  11743.    SET TALK ON
  11744. ENDIF
  11745.  
  11746. IF m.exclusive = "ON"
  11747.    SET EXCLUSIVE ON
  11748. ELSE
  11749.    SET EXCLUSIVE OFF
  11750. ENDIF
  11751. IF m.talkset = "ON"
  11752.    SET TALK ON
  11753. ENDIF
  11754.  
  11755. IF m.cancafter
  11756.    *- CANCEL
  11757. ENDIF
  11758.  
  11759. *
  11760. * WRITERESULT - Writes the converted cursor to the SCX/FRX/LBX/whatever.  The point of this is that we
  11761. *      need to write the records in their original order so we don't mees up any groups.  We also need
  11762. *      to keep records for a given platform contiguous.
  11763. *
  11764. *!*****************************************************************************
  11765. *!
  11766. *!      Procedure: WRITERESULT
  11767. *!
  11768. *!      Called by: CLEANUP            (procedure in TRANSPRT.PRG)
  11769. *!
  11770. *!          Calls: DOCREATE           (procedure in TRANSPRT.PRG)
  11771. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  11772. *!
  11773. *!           Uses: M.G_SCRNALIAS
  11774. *!
  11775. *!        Indexes: TEMP                   (tag)
  11776. *!
  11777. *!*****************************************************************************
  11778. PROCEDURE writeresult
  11779. PRIVATE m.platforms, m.loop, m.thermstep
  11780.  
  11781. IF g_filetype = c_project
  11782.    SELECT (m.g_20alias)        && Close the database so we can replace it.
  11783.    USE
  11784.  
  11785.    SELECT (m.g_scrnalias)      && Copy the temporary cursor to the database and
  11786.    COPY TO (m.g_scrndbf)       &&      get rid of the cursor
  11787.    USE
  11788.    DO updtherm WITH 100
  11789. ELSE
  11790.    REPLACE ALL platform WITH UPPER(platform)
  11791.  
  11792.    * Get a list of the platforms we need to write.
  11793.    SELECT DISTINCT platform ;
  11794.       FROM (m.g_scrnalias) ;
  11795.       WHERE !DELETED() ;
  11796.       INTO ARRAY plist
  11797.    m.platforms = _TALLY
  11798.  
  11799.    * The following select creates a new cursor with the desired structure.  We write
  11800.    * into this and then dump the cursor to disk.  It's a bit cumbersome, but reduces
  11801.    * the chances of frying the original file.
  11802.    m.g_tempalias = "S"+SUBSTR(LOWER(SYS(3)),2,8)
  11803.    DO docreate WITH m.g_tempalias, m.g_filetype
  11804.  
  11805.    * We need to write DOS/UNIX label records in the order we want the objects to appear.
  11806.    * So, we create this index and set order to it when we want to write those records.
  11807.    IF m.g_filetype = c_label
  11808.       SELECT (m.g_scrnalias)
  11809.       INDEX ON platform + ;
  11810.          IIF(objtype = c_ot20label,CHR(1)+CHR(1), STR(objtype,2)) + ;
  11811.          STR(objcode,2) + ;
  11812.          STR(vpos,3) TAG temp
  11813.    ENDIF
  11814.  
  11815.    IF m.g_updenviron
  11816.       SELECT (m.g_scrnalias)
  11817.       INDEX ON outputord(objtype,recno()) TAG temp1
  11818.    ENDIF
  11819.  
  11820.    SELECT (m.g_scrnalias)
  11821.    IF RECCOUNT() > 0
  11822.       m.thermstep = (100 - m.g_mercury)/RECCOUNT()
  11823.    ELSE
  11824.       m.thermstep = 0
  11825.    ENDIF
  11826.  
  11827.    * Write the records for each platform.
  11828.    FOR m.loop = 1 TO m.platforms
  11829.       SELECT (m.g_scrnalias)
  11830.  
  11831.       DO CASE
  11832.       CASE m.g_filetype = c_label
  11833.          SET ORDER TO TAG temp
  11834.       CASE m.g_updenviron
  11835.          SET ORDER TO TAG temp1
  11836.       OTHERWISE
  11837.          SET ORDER TO
  11838.       ENDCASE
  11839.  
  11840.       SCAN FOR platform = plist[m.loop] AND !DELETED()
  11841.          SCATTER MEMVAR MEMO
  11842.          SELECT (m.g_tempalias)
  11843.          APPEND BLANK
  11844.          GATHER MEMVAR MEMO
  11845.          SELECT (m.g_scrnalias)
  11846.  
  11847.          m.g_mercury = MIN(m.g_mercury + m.thermstep, 100)
  11848.          DO updtherm WITH m.g_mercury
  11849.       ENDSCAN
  11850.    ENDFOR
  11851.  
  11852.    SELECT (m.g_20alias)        && Close the database so we can replace it.
  11853.    USE
  11854.  
  11855.    SELECT (m.g_tempalias)      && Copy the temporary cursor to the database and
  11856.    COPY TO (m.g_scrndbf)       &&      get rid of the cursor
  11857.    USE
  11858.  
  11859.    SELECT (m.g_scrnalias)      && Get rid of the master cursor
  11860.    USE
  11861.  
  11862.    DO updtherm WITH 100
  11863. ENDIF
  11864. *!*****************************************************************************
  11865. *!
  11866. *!      Function: VERSNUM
  11867. *!
  11868. *!*****************************************************************************
  11869. FUNCTION versnum
  11870. * Return string corresponding to FoxPro version number
  11871. RETURN wordnum(vers(),2)
  11872.  
  11873. *!*****************************************************************************
  11874. *!
  11875. *!      Function: CPTRANS
  11876. *!
  11877. *!*****************************************************************************
  11878. FUNCTION cptrans
  11879. * Translate from one codepage to another, if translation is in effect.  Note that
  11880. * this function takes parameters in a different order than CPCONVERT.
  11881. PARAMETER m.tocp, m.fromcp, m.strg
  11882. IF c_cptrans AND versnum() > "2.5"
  11883.    RETURN CPCONVERT(m.fromcp, m.tocp, m.strg)
  11884. ELSE
  11885.    RETURN m.strg
  11886. ENDIF
  11887. *!*****************************************************************************
  11888. *!
  11889. *!      Function: CPTCOND
  11890. *!
  11891. *!*****************************************************************************
  11892. FUNCTION cptcond
  11893. * Conditionally translate from one codepage to another, if translation is in effect.
  11894. * Note that this function takes parameters in a different order than CPCONVERT.
  11895. * Only translate if the current database isn't already the tocp.
  11896. PARAMETER m.tocp, m.fromcp, m.strg
  11897. IF c_cptrans AND cpdbf() <> m.tocp AND versnum() > "2.5"
  11898.    RETURN CPCONVERT(m.fromcp, m.tocp, m.strg)
  11899. ELSE
  11900.    RETURN m.strg
  11901. ENDIF
  11902.  
  11903. *!*****************************************************************************
  11904. *!
  11905. *!      Function: setfromcp
  11906. *!
  11907. *!*****************************************************************************
  11908. FUNCTION setfromcp
  11909. PARAMETER m.plat
  11910. DO CASE
  11911. CASE m.plat = c_dosname
  11912.    RETURN c_doscp
  11913. CASE m.plat = c_winname
  11914.    RETURN c_wincp
  11915. CASE m.plat = c_macname
  11916.    RETURN c_maccp
  11917. CASE m.plat = c_unixname
  11918.    RETURN c_unixcp
  11919. OTHERWISE
  11920.    RETURN c_doscp
  11921. ENDCASE
  11922.  
  11923. *!*****************************************************************************
  11924. *!
  11925. *!      Function: oktransport
  11926. *!
  11927. *!*****************************************************************************
  11928. FUNCTION oktransport
  11929. PARAMETER strg
  11930. DIMENSION plat_arry[4]
  11931. plat_arry = 0
  11932. IF ATC("#DOSOBJ",m.strg) > 0
  11933.    plat_arry[dos_code] = 1
  11934. ENDIF
  11935. IF ATC("#WINOBJ",m.strg) > 0
  11936.    plat_arry[win_code] = 1
  11937. ENDIF
  11938. IF ATC("#MACOBJ",m.strg) > 0
  11939.    plat_arry[mac_code] = 1
  11940. ENDIF
  11941. IF ATC("#UNIXOBJ",m.strg) > 0
  11942.    plat_arry[unix_code] = 1
  11943. ENDIF
  11944.  
  11945. * If no platform-specific designations found, transport anywhere
  11946. IF plat_arry[1] + plat_arry[2] + plat_arry[3] + plat_arry[4] = 0
  11947.    plat_arry = 1
  11948. ENDIF
  11949.  
  11950. DO CASE
  11951. CASE m.g_toplatform = c_dosname
  11952.    RETURN IIF(plat_arry[dos_code] = 1, .T.,.F.)
  11953. CASE m.g_toplatform = c_winname
  11954.    RETURN IIF(plat_arry[win_code] = 1, .T.,.F.)
  11955. CASE m.g_toplatform = c_macname
  11956.    RETURN IIF(plat_arry[mac_code] = 1, .T.,.F.)
  11957. CASE m.g_toplatform = c_unixname
  11958.    RETURN IIF(plat_arry[unix_code] = 1, .T.,.F.)
  11959. ENDCASE
  11960.  
  11961. *!*****************************************************************************
  11962. *!
  11963. *!      Function: iserrormsg
  11964. *!
  11965. *!*****************************************************************************
  11966. FUNCTION iserrormsg
  11967. PARAMETER m.strg
  11968. * Was this an error message that the Mac RW added to a report file that
  11969. * didn't have any Windows records?  If so, don't transport it.
  11970. RETURN IIF(ATC("** ERROR", UPPER(m.strg)) > 0, .T., .F.)
  11971.  
  11972. *!*****************************************************************************
  11973. *!
  11974. *!      Function: boxjoin
  11975. *!
  11976. *!*****************************************************************************
  11977. FUNCTION boxjoin
  11978. PARAMETERS m.otype, m.rnum, m.pform
  11979. * Is this text object in a box group and thus boxjoin?
  11980. PRIVATE m.in_rec, m.retval, m.objpos
  11981. m.retval = .F.
  11982. IF m.otype = c_ottext
  11983.    m.in_rec = RECNO()
  11984.  
  11985.    * Get object position (position in linked list of objects) of current record
  11986.    m.objpos = GetObjPos(m.rnum, m.pform)
  11987.    IF m.objpos > 0
  11988.       * Look at all the box groups
  11989.       GOTO TOP
  11990.       SCAN FOR m.pform == platform AND objtype = c_otgroup AND objcode = 1 AND !m.retval
  11991.          * hpos has the starting object number for this group, vpos has the number of
  11992.          * objects the group includes.
  11993.          IF m.objpos >= hpos AND m.objpos <= hpos + vpos - 1
  11994.             m.retval = .T.
  11995.          ENDIF
  11996.       ENDSCAN
  11997.    ENDIF
  11998.    GOTO m.in_rec
  11999. ENDIF
  12000. RETURN m.retval
  12001.  
  12002. *!*****************************************************************************
  12003. *!
  12004. *!      Function: GetObjPos
  12005. *!
  12006. *!*****************************************************************************
  12007. FUNCTION getobjpos
  12008. PARAMETERS m.rnum, m.pform
  12009. PRIVATE m.objcount, m.retval
  12010.  
  12011. * Get ordinal number of this object
  12012. m.objcount = 0
  12013. m.retval = 0
  12014. SCAN FOR m.pform == platform AND INLIST(objtype,C_OBJTYPELIST)
  12015.    m.objcount = m.objcount + 1
  12016.    IF RECNO() = m.rnum
  12017.       m.retval = m.objcount
  12018.    ENDIF
  12019. ENDSCAN
  12020. RETURN m.retval
  12021.  
  12022. *!*****************************************************************************
  12023. *!
  12024. *!      Procedure: InitFontMap
  12025. *!
  12026. *!*****************************************************************************
  12027. PROCEDURE initfontmap
  12028. * Initialize font mapping array.  Windows font characteristics are in the
  12029. * first three columns, Mac in the next three.  These functions are used
  12030. * mainly to map text fields and static text.
  12031. PRIVATE m.i
  12032.  
  12033. *****************************************************************************
  12034. * Font characteristic table for some common fonts (from FontMetric()):
  12035. *
  12036. *                     8     8B     9     9B     10     10B     12
  12037. *                ---------------------------------------------------
  12038. * Geneva                 4x11   5x11  5x12   6x12    6x13     7x13    7x16
  12039. * Chicago             4x11   5x11  5x12   6x12    6x13     7x13    7x16
  12040. * MS Sans Serif      5x13   6x13     5x13   6x13   7x16   8x16    8x20
  12041. * Arial              5x14   5x14  5x15   6x15   6x16   6x16    8x19
  12042. * FoxFont            7x9    8x9   8x12   9x12   8x12   9x12    8x12
  12043. * Courier New        7x14   7x14  7x15   7x16   8x16   8x16    10x18
  12044. *****************************************************************************
  12045.  
  12046. g_fontmap[1,1] = "MS Sans Serif"
  12047. g_fontmap[1,2] = 8
  12048. g_fontmap[1,3] = "B"
  12049. g_fontmap[1,4] = "Geneva"
  12050. g_fontmap[1,5] = 10
  12051. g_fontmap[1,6] = ""
  12052.  
  12053. g_fontmap[2,1] = "MS Sans Serif"
  12054. g_fontmap[2,2] = 8
  12055. g_fontmap[2,3] = ""
  12056. g_fontmap[2,4] = "Geneva"
  12057. g_fontmap[2,5] = 9
  12058. g_fontmap[2,6] = ""
  12059.  
  12060. g_fontmap[3,1] = "Courier New"
  12061. g_fontmap[3,2] = 0    && wildcard
  12062. g_fontmap[3,3] = "*"  && wildcard
  12063. g_fontmap[3,4] = "Courier"
  12064. g_fontmap[3,5] = 0
  12065. g_fontmap[3,6] = "*"
  12066.  
  12067. FOR m.i = 1 TO ALEN(g_fontmap,1)
  12068.    g_fontmap[m.i,1] = UPPER(ALLTRIM(g_fontmap[m.i,1]))
  12069.    g_fontmap[m.i,3] = UPPER(ALLTRIM(g_fontmap[m.i,3]))
  12070.    g_fontmap[m.i,4] = UPPER(ALLTRIM(g_fontmap[m.i,4]))
  12071.    g_fontmap[m.i,6] = UPPER(ALLTRIM(g_fontmap[m.i,6]))
  12072. ENDFOR
  12073. *!*****************************************************************************
  12074. *!
  12075. *!      Procedure: MapFont
  12076. *!
  12077. *!*****************************************************************************
  12078. PROCEDURE mapfont
  12079. PARAMETER m.inface, m.insize, m.instyle, m.outface, m.outsize, m.outstyle, m.win2mac
  12080. PRIVATE m.i, m.asterisk, m.aoff   && array offset
  12081.  
  12082. m.asterisk = "*"
  12083. m.aoff = IIF(m.win2mac,0,3)
  12084. FOR m.i = 1 TO ALEN(g_fontmap,1)
  12085.    IF g_fontmap[m.i,1+m.aoff] == UPPER(ALLTRIM(m.inface)) ;
  12086.          AND INLIST(g_fontmap[m.i,2+m.aoff],m.insize,0) ;
  12087.          AND INLIST(g_fontmap[m.i,3+m.aoff],UPPER(ALLTRIM(m.instyle)),m.asterisk)
  12088.       m.outface  = g_fontmap[m.i,4-m.aoff]
  12089.  
  12090.       IF g_fontmap[m.i,2+m.aoff] = 0   && wildcard match on size?
  12091.          m.outsize  = m.insize
  12092.       ELSE
  12093.          m.outsize  = g_fontmap[m.i,5-m.aoff]
  12094.       ENDIF
  12095.  
  12096.       IF g_fontmap[m.i,6-m.aoff] = m.asterisk   && wildcard match on style?
  12097.          m.outstyle = m.instyle
  12098.       ELSE
  12099.          m.outstyle = g_fontmap[m.i,6-m.aoff]
  12100.       ENDIF
  12101.       RETURN
  12102.    ENDIF
  12103. ENDFOR
  12104. * Let the operating system handle the font mapping
  12105. m.outface = m.inface
  12106. m.outsize = m.insize
  12107. m.outstyle = m.instyle
  12108. RETURN
  12109.  
  12110. *!*****************************************************************************
  12111. *!
  12112. *!      Procedure: REPLFONT
  12113. *!
  12114. *!*****************************************************************************
  12115. PROCEDURE replfont
  12116. PRIVATE m.theface, m.thesize, m.thestyle
  12117. * Replace the current font with a mapped one, if one matches
  12118. m.theface = ""
  12119. m.thesize = 0
  12120. m.thestyle = ""
  12121. DO mapfont WITH fontface, fontsize, num2style(fontstyle), ;
  12122.    m.theface, m.thesize, m.thestyle, _MAC
  12123. IF !EMPTY(m.theface)
  12124.    REPLACE fontface WITH m.theface, fontsize WITH m.thesize, ;
  12125.        fontstyle WITH style2num(m.thestyle)
  12126. ENDIF
  12127.  
  12128. *!*****************************************************************************
  12129. *!
  12130. *!      Procedure: MAKE2D
  12131. *!
  12132. *!*****************************************************************************
  12133. FUNCTION make2d
  12134. * Add a 2 to the control portion of the picture string
  12135. PARAMETER m.strg
  12136. m.strg = TRIM(m.strg)
  12137. PRIVATE m.sp_pos, m.ctrl
  12138.  
  12139. m.sp_pos = AT(" ",strg)
  12140. DO CASE
  12141. CASE m.sp_pos > 0 AND AT('@', m.strg) > 0
  12142.    m.ctrl = LEFT(m.strg, m.sp_pos - 1)
  12143.     IF AT(c_2dmark,m.ctrl) = 0
  12144.        m.ctrl = m.ctrl + c_2dmark
  12145.        m.strg = m.ctrl + SUBSTR(m.strg, m.sp_pos)
  12146.     ENDIF
  12147. CASE EMPTY(m.strg)
  12148.    m.strg = "@" + c_2dmark
  12149. CASE AT(c_2dmark,strg) = 0
  12150.     IF isquote(RIGHT(m.strg,1))
  12151.        IF SUBSTR(m.strg,2,1) = "@"
  12152.            * Something like "@!".  Make it "@!2"
  12153.          m.strg = SUBSTR(m.strg, 1, LEN(m.strg) - 1) + c_2dmark + RIGHT(m.strg,1)
  12154.         ELSE
  12155.            * Something like "!!!".  Make it "@2 !!!"
  12156.          m.strg = SUBSTR(m.strg, 1, 1) + "@" + c_2dmark + " "+SUBSTR(m.strg,2)
  12157.         ENDIF
  12158.      ELSE
  12159.        IF SUBSTR(m.strg,2,1) = "@"
  12160.            * Something like @!.  Make it @!2
  12161.          m.strg = m.strg + c_2dmark
  12162.         ELSE
  12163.            * Something like !!!.  Make it @2 !!!
  12164.          m.strg =  "@" + c_2dmark + " " + m.strg
  12165.         ENDIF
  12166.     ENDIF
  12167. ENDCASE
  12168. RETURN m.strg
  12169.  
  12170. *!*****************************************************************************
  12171. *!
  12172. *!      Procedure: MAKE3D
  12173. *!
  12174. *!*****************************************************************************
  12175. FUNCTION make3d
  12176. * Add a 3 to the control portion of the picture string
  12177. PARAMETER m.strg
  12178. m.strg = TRIM(m.strg)
  12179. PRIVATE m.sp_pos, m.ctrl
  12180.  
  12181. m.sp_pos = AT(" ",strg)
  12182. DO CASE
  12183. CASE m.sp_pos > 0 AND AT('@', m.strg) > 0
  12184.    m.ctrl = LEFT(m.strg, m.sp_pos - 1)
  12185.     IF AT(c_3dmark,m.ctrl) = 0
  12186.        m.ctrl = m.ctrl + c_3dmark
  12187.        m.strg = m.ctrl + SUBSTR(m.strg, m.sp_pos)
  12188.     ENDIF
  12189. CASE EMPTY(m.strg)
  12190.    m.strg = "@" + c_3dmark
  12191. CASE AT(c_3dmark,strg) = 0
  12192.     IF isquote(RIGHT(m.strg,1))
  12193.        IF SUBSTR(m.strg,2,1) = "@"
  12194.            * Something like "@!".  Make it "@!3"
  12195.          m.strg = SUBSTR(m.strg, 1, LEN(m.strg) - 1) + c_3dmark + RIGHT(m.strg,1)
  12196.         ELSE
  12197.            * Something like "!!!".  Make it "@3 !!!"
  12198.          m.strg = SUBSTR(m.strg, 1, 1) + "@" + c_3dmark + " "+SUBSTR(m.strg,2)
  12199.         ENDIF
  12200.      ELSE
  12201.        IF SUBSTR(m.strg,2,1) = "@"
  12202.            * Something like @!.  Make it @!3
  12203.          m.strg = m.strg + c_3dmark
  12204.         ELSE
  12205.            * Something like !!!.  Make it @3 !!!
  12206.          m.strg =  "@" + c_3dmark + " " + m.strg
  12207.         ENDIF
  12208.     ENDIF
  12209. ENDCASE
  12210. RETURN m.strg
  12211.  
  12212. *!*****************************************************************************
  12213. *!
  12214. *!      Function: ADDQUOTE
  12215. *!
  12216. *!*****************************************************************************
  12217. FUNCTION addquote
  12218. PARAMETER m.strg
  12219. * Add quotes if they aren't already there
  12220. IF !INLIST(LEFT(m.strg,1) , CHR(34) , CHR(39) , '[')
  12221.     DO CASE
  12222.     CASE AT('"', m.strg) = 0
  12223.        m.strg = '"' + m.strg + '"'
  12224.     CASE AT("'", m.strg) = 0
  12225.        m.strg = "'" + m.strg + "'"
  12226.    CASE AT('[', m.strg) = 0 AND AT(']', m.strg) = 0
  12227.         m.strg = '[' + m.strg + ']'
  12228.     OTHERWISE
  12229.        * Take our best shot
  12230.        m.strg = '"' + m.strg + '"'
  12231.     ENDCASE
  12232. ENDIF
  12233. RETURN m.strg
  12234. *!*****************************************************************************
  12235. *!
  12236. *!      Function: ISQUOTE
  12237. *!
  12238. *!*****************************************************************************
  12239. FUNCTION isquote
  12240. PARAMETER m.char
  12241. IF INLIST(m.char,CHR(34),CHR(39))
  12242.    RETURN .T.
  12243. ELSE
  12244.    RETURN .F.
  12245. ENDIF
  12246.  
  12247. *!*****************************************************************************
  12248. *!
  12249. *!      Procedure: FONTAVAIL
  12250. *!
  12251. *!*****************************************************************************
  12252. FUNCTION fontavail
  12253. PARAMETER m.thefont
  12254. m.thefont = UPPER(ALLTRIM(m.thefont))
  12255. IF ASCAN(g_fontavail, m.thefont) > 0
  12256.    RETURN .T.
  12257. ELSE
  12258.    RETURN .F.
  12259. ENDIF
  12260.  
  12261. *!*****************************************************************************
  12262. *!
  12263. *!      Procedure: FIXPEN
  12264. *!
  12265. *!*****************************************************************************
  12266. PROCEDURE fixpen
  12267. * Make sure that the pen_color fields don't overflow.  A bug in the beta
  12268. * version of FoxPro 2.5 sometimes caused this to happen.  It was corrected
  12269. * prior to release.
  12270. IF penred > 65536
  12271.    REPLACE penred WITH 0
  12272. ENDIF
  12273. IF pengreen > 65536
  12274.    REPLACE pengreen WITH 0
  12275. ENDIF
  12276. IF penblue > 65536
  12277.    REPLACE penblue WITH 0
  12278. ENDIF
  12279.  
  12280. *!*****************************************************************************
  12281. *!
  12282. *!      Procedure: ASSERT
  12283. *!
  12284. *!*****************************************************************************
  12285. PROCEDURE assert
  12286. PARAMETER condition, strg
  12287. IF debugversion
  12288.    IF !condition
  12289.       WAIT WINDOW T_ASSERTFAIL_LOC+strg
  12290.    ENDIF
  12291. ENDIF
  12292. *: EOF: TRANSPRT.PRG
  12293.